我正在使用带有'--files-from'的rsync,我想排除这个列表中的其中一个由过滤器"保护",但似乎它不起作用.
这是我的设置:
/backuplist.txt文件的内容:
path1
path2/and/more
Run Code Online (Sandbox Code Playgroud)
rsync命令是这样的:
rsync -aHr --filter "protect path1/*" $dry --progress --delete --force --inplace --delete-after --files-from=/backuplist.txt /source /target
Run Code Online (Sandbox Code Playgroud)
我想要的是递归地将文件从'/ source/path1'和'/ source/path2 /和/ more'复制到'/ target/path1'和'/ target/path2 /和/ more'.应删除目标路径中存在的源路径中不存在的所有内容,除了下面的"/ target/path1"中的任何文件(!)
我尝试了以下不起作用的过滤器:
--filter "protect path1/*"
--filter "protect path1/"
--filter "protect path1"
--filter "protect /path1"
Run Code Online (Sandbox Code Playgroud)
欢迎任何帮助!
感谢您的参与,但在阅读和测试后,我找到了解决方案:
而不是这个:
--filter "protect path1/*"
Run Code Online (Sandbox Code Playgroud)
它一定要是:
--filter "protect path1/**/*"
Run Code Online (Sandbox Code Playgroud)
它在一个rsync调用中就像一个魅力.