I have a lot of directories in the initial folder and I want to zip everything , but exclude
all the node_modules
folder of each directory , I tried this:
zip -r all_repos.zip . -x '*node_modules*'
But it doesn't exclude all sub-folders.
Any idea how to do it recursively ?
zip -r ~/code_with_node_modules_excluded.zip ~/code/ -x '*node_modules*/*' -x '*vendor*/*' -x '*.cache*/*' -x '*.next*/*' -x '*target*/*'
was very helpful for me. 32G down to just 1.1G! (according tocd ~/code/ && du -aBM 2>/dev/null | sort -nr | head -n 10
anddu --max-depth=0 -h ~/code
) – Ryan Jan 09 '23 at 22:05