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

/var/www/testing/file1.iso_fpart0
/var/www/testing/file1.iso_fpart1
/var/www/testing/file1.iso_fpart2
/var/www/testing/file1.iso
/var/www/testing/file2.xls_fpart0
/var/www/testing/file2.xls

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

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

Try this:

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

You must log in to answer this question.