bob
bob

Reputation: 943

How can I exclude both the .git directories and the node_modules directory when using zip?

I want to zip all contents of the present directory into a zip file. While doing this I want to exclude both the .git directory and the node_modules directory.

These commands will exclude .git dir's, but fail to exclude node_modules:

zip -r output.zip . -x '*.git*' -x 'node_modules'

zip -r output.zip . -x '*.git*' 'node_modules'

Upvotes: 4

Views: 2880

Answers (1)

Reynaldo Aceves
Reynaldo Aceves

Reputation: 749

Please adjust your command to:

zip -r output.zip . -x '*.git*' -x '*node_modules*'

Upvotes: 9

Related Questions