阅读623 返回首页    go 阿里云 go 技术社区[云栖]


rsync cannot delete non-empty directory

When syncing my remote backup I get the error rsync cannot delete non-empty directory.

I know the cause: I have excluded some files and when rsync tries to delete a remote directory because it doesn't exists locally, it can't since it is not empty. Without the exclusion the directory would be emptied.

I also know I could get rid of the problem by using --delete-excluded, but that is not want I want.

I would like to skip uploading certain files (because they are too big for my upload speed), but I want to keep those I have already uploaded some time ago if they exist locally. If they do not exist locally, they should be deleted. --delete-excluded would delete them all on the remote side.

That also means that if a directory doesn't exists anymore locally, it should be deleted even if it contains excluded files.

Is it possible to setup rsync to accomplish this?

linux rsync
1 Answer

just use the '--max-size=xx' and '--delete' options of rsync. It will do everything automatically and meet all your requirements.

最后更新:2017-11-18 03:34:11

  上一篇:go  rsync样例
  下一篇:go  php安装redis扩展