Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

trying to exclude all .svn folders in the zipped subfolders

zip -urq bebe.zip * -x .svn

doesn't work...

share|improve this question

2 Answers 2

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 bebe.zip -@

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 bebe.zip * -x '*/.svn'

share|improve this answer
3  
no, sorry. but this one worked zip -urq bebe.zip * -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

 
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.