zip to exclude all .svn folders
6,547
Solution 1
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.
Solution 2
Try zip -urq bebe.zip * -x '*/.svn'
Related videos on Youtube
Author by
Michael
Updated on September 17, 2022Comments
-
Michael almost 2 years
trying to exclude all .svn folders in the zipped subfolders
zip -urq bebe.zip * -x .svn
doesn't work...
-
Michael about 14 yearsno, sorry. but this one worked
zip -urq bebe.zip * -x '*/.svn/*'
-
Mo. about 14 yearsah — 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!
-
Michael Pliskin about 13 yearsActually simpler than the first reply, so sticking with this one.