Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am compressing a dir into a zip, and use several -x switches.

7z a -tzip -x!.\test1.gadget\.git\* -x!.\test1.gadget\.gitignore test1.zip  .\test1.gadget\*  

7-Zip [64] 9.22 beta  Copyright (c) 1999-2011 Igor Pavlov  2011-04-18
Scanning

Creating archive test1.zip

Compressing  .git\COMMIT_EDITMSG
Compressing  .git\config
Compressing  .git\description
Compressing  .git\HEAD

However, instead of the ~20k I expect the zip file to be (based on the size of the desired content), the zip file is ~120k. When inspecting the zip file, none of the excluded content (the .git dir) is present.

Any ideas on what I'm doing wrong?
Thanks...

share|improve this question

migrated from stackoverflow.com Jun 9 '13 at 22:31

This question came from our site for professional and enthusiast programmers.

    
Err… so when you list the contents of the archive lose bad files are not there? – kirelagin Jun 9 '13 at 19:17
    
Correct -- archive is still the size I expect it would be if the excluded files were present. – Number8 Jun 9 '13 at 23:17
    
How do you estimate the expected archive size? – gronostaj Jun 9 '13 at 23:52
    
Try putting the files to include first, followed by those you want excluded. – martineau Jun 10 '13 at 0:38
    
@gronostaj: size of zip before trying to exclude. – Number8 Jun 10 '13 at 12:14

Thanks, folks, for the help, this seems to work as desired:
7z a -tzip test.zip test.gadget* -x!test.gadget.git\ -x!test.gadget.idea\ -x!test.gadget.gitignore

share|improve this answer

You must log in to answer this question.

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