繁体   English   中英

bash:如何选择性地将目录从一棵树复制到另一棵树?

[英]bash: How do I selectively copy directories from one tree to another?

我的目录树看起来有点像这样:

/Volumes/Data/TEMP/DROP
├───R1
│   ├───morestuff
│   │   └───stuff2
│   │       └───C.tool
│   └───stuff
│       ├───A.tool
│       └───B.Tool
└───R2
    ├───morestuff
    │   └───stuff2
    │       └───C.tool
    └───stuff
        ├───A.tool
        └───B.Tool

如何将*.tool目录从R1递归复制到(覆盖) R2中的目录? 我的 bash 上面有大约 20 年的 rust。

这将起作用(扩展@Maxim Egorushkin 的想法)


# The trailing slash important in the next line
SOURCE=/Volumes/Data/TEMP/DROP/R1/
DEST=/Volumes/Data/TEMP/DROP/R2
rsync -zarv --include "*/" --include="*.tool" --exclude="*" "$SOURCE" "$DEST"


暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM