V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
xiaoz
1.03D
V2EX  ›  Linux

rsync delete 不生效?

  •  
  •   xiaoz ·
    helloxz · Nov 26, 2017 · 2942 views
    This topic created in 3084 days ago, the information mentioned may be changed or developed.

    目录一

    [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 replies    2017-11-26 15:18:59 +08:00
    xiaoz
        1
    xiaoz  
    OP
       Nov 26, 2017
    @xcai 解决了,改成这样就可以了:rsync --delete-after -avz /home/test/dir1/ /home/test/dir2
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   923 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 21:40 · PVG 05:40 · LAX 14:40 · JFK 17:40
    ♥ Do have faith in what you're doing.