Reputation: 57923
What's a combination of commands on MacOS that'll start at the root of some directory tree and create a zip file archive of it, preserving directory structure, but only including files with extensions "ext1" and "ext2"?
Upvotes: 0
Views: 344
Reputation: 4475
How about:
cd DIRECTORY/..
find DIRECTORY -type f '(' -name '*.ext1' -or -name '*.ext2' ')' | xargs zip OUTPUT
(First chdir to the parent of the desired directory so that the paths in the ZIP file will include that directory but no parents in its path names).
Upvotes: 1