Linux: 如何递归复制省略某个文件夹?
Linux: How to copy recursively omitting certain folder?
示例:
dir1
|_ filea
|_ fileb
|_ foldera
|_ filez
|_ folderxy
|_ filexy
我想用 cp -r dir1 desti/nation
复制 dir1
但省略 folderxy
。
我该怎么做?
尝试 rsync。如果你有很多东西要排除,你可以创建一个文件并将其作为 --exclude-from=filename
传递。看这个回答here.
rsync -av --exclude='path1' --exclude='path2' source destination
示例:
dir1
|_ filea
|_ fileb
|_ foldera
|_ filez
|_ folderxy
|_ filexy
我想用 cp -r dir1 desti/nation
复制 dir1
但省略 folderxy
。
我该怎么做?
尝试 rsync。如果你有很多东西要排除,你可以创建一个文件并将其作为 --exclude-from=filename
传递。看这个回答here.
rsync -av --exclude='path1' --exclude='path2' source destination