我有一个相对较大的目录结构,其组织非常一致,我需要将其部分复制到新位置。
这是我所拥有的:
./dev
/man
<.txt files>
/other dir
/another dir
./mod
/man
<.txt files>
/other dir
/another dir
./blah
/other dir
/another dir
我感兴趣的是 man 目录中的 .txt 文件。有些目录有/man/,有些则没有,比如上面的 ./blah。
我需要做的是在新位置使用/man/重现目录结构:
/opt/dev
/man
<.txt files>
/opt/mod
/man
<.txt files>
我尝试了 find、rsync、cp 等多种不同的变体,但没有找到有效的方法。
最佳答案
这对我有用:cp --parents ./*/man/*.txt/opt
关于linux - 将目录结构的一部分复制到新位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25437345/