开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜