Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
1  
Doesn't 7za x extract with full paths, and 7za e extract without paths? Try changing that. –  Daniel Andersson Feb 13 '13 at 12:02

1 Answer 1

up vote 1 down vote accepted

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).

share|improve this answer
    
A little more explanation would go a long way to making this a better answer. –  ChrisF Feb 13 '13 at 12:58
    
Thank you very much. This works and my issue is resolved. –  user197909 Feb 13 '13 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. –  Stefan Seidel Feb 13 '13 at 13:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.