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'

Share:
6,547

Related videos on Youtube

Michael
Author by

Michael

Updated on September 17, 2022

Comments