我的目录树看起来有点像这样:
/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年的铁锈。
这将起作用(扩展@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"