tags:

views:

12

answers:

1

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"?

+1  A: 

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).

llasram
thanks, works great!
Yaroslav Bulatov