提取指定类型文件到指定目录,保留目录结构

mkdir ../include || find  ./ ( -name *.h -or -name *.hpp )  -exec cp --parent {} ../include ;

mkdir ../src || find  ./ ( -name *.cpp  )  -exec cp --parent {} ../src ;

cp --parent会保留目录结构

参考:

https://unix.stackexchange.com/questions/50612/how-to-combine-2-name-conditions-in-find

https://stackoverflow.com/questions/1133698/find-name-pattern-that-matches-multiple-patterns

https://unix.stackexchange.com/questions/298218/extract-files-with-specific-file-extension-and-keep-directory-structure

原文地址:https://www.cnblogs.com/wolbo/p/14154877.html