V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
xiaoz
V2EX  ›  Linux

rsync delete 不生效?

  •  
  •   xiaoz ·
    helloxz · 2017-11-26 14:52:51 +08:00 · 2499 次点击
    这是一个创建于 2314 天前的主题,其中的信息可能已经有所发展或是发生改变。

    目录一

    [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没有被删除,也没有任何报错,请问是什么原因?

    1 条回复    2017-11-26 15:18:59 +08:00
    xiaoz
        1
    xiaoz  
    OP
       2017-11-26 15:18:59 +08:00
    @xcai 解决了,改成这样就可以了:rsync --delete-after -avz /home/test/dir1/ /home/test/dir2
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5284 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 09:28 · PVG 17:28 · LAX 02:28 · JFK 05:28
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.