Ubuntu: how to pin a directory in ubuntu by excluding some subdirectories from the command line

I want to archive the directory, excluding some unwanted subdirectories. I tried:

zip -r test.zip * -x 'test1/' 'test2/'

and

zip -r test.zip * -x 'test1/' -x 'test2/'

But nothing happens.

+4
source share
1 answer

Try

zip -r test.zip * -x test1/\* test2/\*

\*is an escaped wildcard character that avoids the shell extending the path before passing in zip.

+17
source

All Articles