0

I have a zip file (my.zip) consisting of 4 files:

  • mydata_20050523-20130113.csv
  • mydata_20050523-20130113FileHeader.csv
  • my Data Association - Code Values.pdf
  • my Data Association - Readme.pdf

out of which I need only one file: "mydata_20050523-20130113.csv". The other 3 are supporting documents.

I tried to use the command below:

7za x my.zip -x!*FileHeader.csv -x!*.pdf

This used to work previously as the files were directly extracted without any folder structure. However, now when extracting there is a directory structure which is extracted underneath which the files are present. So it is not working.

Could anyone help me out?

1
  • 1
    Doesn't 7za x extract with full paths, and 7za e extract without paths? Try changing that. Feb 13, 2013 at 12:02

1 Answer 1

1

Use the -xr0 switch with a wildcard:

7za x my.zip -xr0!\*/FileHeader.csv -xr0!\*.pdf

Explanation: -x operates only on filenames by default and doesn't support recursion. -xr0 will operate on subdirectories (r) and allows the use of wildcards in these (0).

3
  • A little more explanation would go a long way to making this a better answer.
    – ChrisF
    Feb 13, 2013 at 12:58
  • Thank you very much. This works and my issue is resolved.
    – user197909
    Feb 13, 2013 at 13:19
  • You're welcome, and don't forget to "accept" my answer so that others who have the same problem will find it more easily. Feb 13, 2013 at 13:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .