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 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
show 2 more comments

1 Answer 1

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
add comment

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.