Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

linux

bash

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'
like image 247
bob Avatar asked Oct 29 '25 06:10

bob


1 Answers

Please adjust your command to:

zip -r output.zip . -x '*.git*' -x '*node_modules*'
like image 119
Reynaldo Aceves Avatar answered Oct 31 '25 00:10

Reynaldo Aceves



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!