zip archive from a directory tree but only include files with extensions xx1,xx2,...?
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开发者_C百科 "ext1" and "ext2"?
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).
精彩评论