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 .

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
  • 1
    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
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.

  • x command option is for excluding. – a3.14_Infinity Mar 28 '13 at 19:26

Try this:

find . -name "*_fpart*" -print | zip total.zip -@

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy