Server Fault is a question and answer site for system and network administrators. 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

trying to exclude all .svn folders in the zipped subfolders

zip -urq * -x .svn

doesn't work...

share|improve this question
up vote 2 down vote accepted

It seems like -x works with file names and not with directories. I don't fully understand how this option works.

But I do have a solution for your question :

find . -type d -name .svn -prune -o -print | zip -uq -@

The find command excludes all directories named .svn (-type d -name .svn -prune) and lists all other files and folders (-o -print). The list is passed to zip through a pipe (-@ option read list of files in standard input).

If you don't want to only include directories with regular files, you can use -o -type f -print instead.

share|improve this answer

Try zip -urq * -x '*/.svn'

share|improve this answer
no, sorry. but this one worked zip -urq * -x '*/.svn/*' – Michael May 27 '10 at 14:01
ah — yes, sorry, of course. I looked back at an example of when I’d tried it, and I’d apparently only excluded files, not folders. apologies! – Mo. May 27 '10 at 15:30
Actually simpler than the first reply, so sticking with this one. – Michael Pliskin Jun 7 '11 at 12:18

Your Answer


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.