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.
相关文章
mkdir: cannot create directory `**': No such file or directory
在mkdir时报错的解决方案,在网上找了很多文章都没有说清楚原因。
444 0
|
4月前
|
安全 网络安全 数据安全/隐私保护
auth required pam_tally2.so file=/var/log/tallylog onerr=fail deny=3 unlock_time=300 even_deny_root root_unlock_time=300 什么作用
【8月更文挑战第14天】auth required pam_tally2.so file=/var/log/tallylog onerr=fail deny=3 unlock_time=300 even_deny_root root_unlock_time=300 什么作用
108 0
|
6月前
|
Shell 应用服务中间件 Linux
已解决:Cannot find ./catalina.sh The file is absent or does not have execute permission This file is ne
已解决:Cannot find ./catalina.sh The file is absent or does not have execute permission This file is ne
73 0
|
7月前
|
Shell
adb: error: cannot create file/directory ‘d:/1.png‘: No such file or directory
adb: error: cannot create file/directory ‘d:/1.png‘: No such file or directory
114 0
|
Java API
Files.delete
Files.delete
54 0
ftok info: No such file or directory
ftok info: No such file or directory
210 0
|
分布式计算 安全 Hadoop
hdfs mkdir报错Cannot create directory /usr. Name node is in safe mode.
hdfs mkdir报错Cannot create directory /usr. Name node is in safe mode.
405 0
|
开发工具 容器
解决报错:Couldn't create temporary file /tmp/apt.conf.IRqbCz
问题 操作容器应该是属于服务器开发同学的常规操作,经常我们会遇到系统缺少对应的工具的情况,比如我们进入容器后,想使用 vim 修改某个文件,但是发现该容器没有安装 vim 工具。这个时候,一般都需要自己手动安装,比如在 unbuntu 系统中,可以使用 apt-get 包管理命令。
751 0
解决报错:Couldn't create temporary file /tmp/apt.conf.IRqbCz
|
Linux Windows
SVN更新被Locked,Can't open file 'folder/.svn/tmp/text-base/file.svn-base'
SVN更新被Locked,Can't open file 'folder/.svn/tmp/text-base/file.svn-base'
177 0
SVN更新被Locked,Can't open file 'folder/.svn/tmp/text-base/file.svn-base'