ubuntu: How to zip a directory in ubuntu by excluding some subdirectories from command line

ubuntu, zip

Solution

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`.

Problem

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.

Original source