rsync delete 不生效?

2017-11-26 14:52:51 +08:00
 xiaoz

目录一

[root@zhanmei dir1]# ll
total 0
-rw-r--r-- 1 root root  0 Nov 26 14:24 1.txt
drwxr-xr-x 2 root root 19 Nov 26 14:24 abc

目录二

[root@zhanmei dir2]# ll
total 0
-rw-r--r-- 1 root root 0 Nov 26 14:39 2.txt

需求

dir1使用 rsync 同步到dir2,并删除dir2里面的2.txt执行的命令如下:

rsync --delete-after * -avz  /home/test/dir1/* /home/test/dir2

但是发现dir2/2.txt没有被删除,也没有任何报错,请问是什么原因?

2515 次点击
所在节点    Linux
1 条回复
xiaoz
2017-11-26 15:18:59 +08:00
@xcai 解决了,改成这样就可以了:rsync --delete-after -avz /home/test/dir1/ /home/test/dir2

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/409636

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX