0

Added from SO as off topic, however there is no answer in here

I want to zip a directory by excluding some unwanted subdirectories. I have tried :

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

and

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

But nothing happens.

1 Answer 1

0

Credits to Akhil (q.) and Naota (ans.)

Try

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

The \* is an escaped wildcard character, which avoids path expansion by the shell prior to being passed to zip.

Reference (check --include explanation)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .