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 was wondering, if I have a folder structure like this:


how can I run zip command, zip everything except file ending with _fpartNumber. I only know this command,

zip -r total.zip .
share|improve this question

migrated from stackoverflow.com Mar 28 '13 at 20:15

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

Surely you must be aware of the commands zip --help and man zip too –  Crisp Mar 28 '13 at 19:21
You might try posting this at unix.stackexchange.com instead of here. –  EmmyS Mar 28 '13 at 19:29
@Harts I've updated my answer to show a wildcard for the number. –  AbsoluteƵERØ Mar 29 '13 at 21:01

2 Answers 2

zip -r foo foo -x \*.o 

which will include the contents of foo in foo.zip while excluding all the files that end in .o.

share|improve this answer
x command option is for excluding. –  gansai Mar 28 '13 at 19:26

Try this:

find . -name "*_fpart*" -print | zip total.zip -@
share|improve this answer

Your Answer


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