I would like to zip the directory but exclude some subdirectories. Let's say I have such structure:
directory subdirectory 1 subdirectory 2 project 1 html directory 1 vendor node_modules ... (other directories) project 2 html directory 2 vendor node_modules ... (other directories)
I would like to ZIP the whole main directory but I would like to exclude paths like this:
*- is one-level directory
**- is directory with any files and subdirectories
The problem is that those
project 1 and
project 2 are quite dynamic - there are multiple of them. Also notice that
vendor directories (and also in theory
node_modules) can be placed in some other places for example in
project 1/html/public/vendor so I wouldn't like to exclude just
vendor subdirectory but only specific
vendor subdirectory that is located exactly in given html directories of projects.
Is it possible to make such complex thing using just
zip command or maybe some bash script should be written for this?
I'm using MacOS if it makes any difference.
What I've achieved so far is:
cd directory && zip test-zip.zip * -r -T -x */*/html/vendor/** */*/html/node_modules/**
It seems it almost works but it creates empty vendor and node modules directories (but not include their content)