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

相关文章:

  • 2021-11-23
  • 2021-11-07
  • 2021-11-07
  • 2021-10-16
  • 2021-11-23
  • 2021-09-11
  • 2021-11-07
  • 2021-11-13
猜你喜欢
  • 2021-11-23
  • 2021-12-02
  • 2021-09-28
  • 2021-11-07
  • 2021-09-15
  • 2021-11-23
相关资源
相似解决方案