rsync同步报错cannot delete non-empty directory的问题

# rsync同步报错,目录不为空不能删除的问题
# rsync -zavP --password-file="/data/www/.rsync/rsyncd.aliszdownload" --exclude=cbs_down --delete /data/www/vhosts/download.chinasoft.com/httpdocs/ apache@1.1.1.1::apache/data/www/vhosts/download.chinasoft.com/httpdocs/

cannot delete non-empty directory: data/www/vhosts/download.chinasoft.com/httpdocs
cannot delete non-empty directory: data/www/vhosts/download.chinasoft.com/httpdocs
cannot delete non-empty directory: data/www/vhosts/download.chinasoft.com
cannot delete non-empty directory: data/www/vhosts/download.chinasoft.com
cannot delete non-empty directory: data/www/vhosts
cannot delete non-empty directory: data/www/vhosts
cannot delete non-empty directory: data/www

--delete-excluded

# 可以加上参数 --delete-excluded 就可以删除了

[root@download-web01:~]# rsync -zavP --password-file="/data/www/.rsync/rsyncd.aliszdownload" --exclude=cbs_down --delete --delete-excluded /data/www/vhosts/download.chinasoft.com/httpdocs/ apache@1.1.1.1::apache/data/www/vhosts/download.chinasoft.com/httpdocs/
sending incremental file list
deleting cbs_down
deleting data/www/vhosts/download.chinasoft.com/httpdocs/cbs_down
deleting data/www/vhosts/download.chinasoft.com/httpdocs/
deleting data/www/vhosts/download.chinasoft.com/
deleting data/www/vhosts/
deleting data/www/
developer/
developer/12.5.zip
      2,660,463 100%    7.02MB/s    0:00:00 (xfr#1, ir-chk=1020/5507)

sent 2,883,387 bytes  received 634 bytes  824,006.00 bytes/sec
total size is 264,107,857,202  speedup is 91,576.26

原文地址:https://www.cnblogs.com/reblue520/p/14184848.html