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.
相关文章
|
3月前
|
安全 网络安全 数据安全/隐私保护
auth required pam_tally2.so file=/var/log/tallylog onerr=fail deny=3 unlock_time=300 even_deny_root root_unlock_time=300 什么作用?
【8月更文挑战第2天】auth required pam_tally2.so file=/var/log/tallylog onerr=fail deny=3 unlock_time=300 even_deny_root root_unlock_time=300 什么作用?
48 1
|
3月前
|
安全 网络安全 数据安全/隐私保护
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 什么作用
76 0
|
5月前
|
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
61 0
|
11月前
|
Java API
Files.delete
Files.delete
50 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.
379 0
|
开发工具 容器
解决报错:Couldn't create temporary file /tmp/apt.conf.IRqbCz
问题 操作容器应该是属于服务器开发同学的常规操作,经常我们会遇到系统缺少对应的工具的情况,比如我们进入容器后,想使用 vim 修改某个文件,但是发现该容器没有安装 vim 工具。这个时候,一般都需要自己手动安装,比如在 unbuntu 系统中,可以使用 apt-get 包管理命令。
729 0
解决报错:Couldn't create temporary file /tmp/apt.conf.IRqbCz
|
运维
yum update 执行报错: error : unpacking of archive failed on file /usr/.../...;5d26ff7c: cpio : symlink
yum update 执行报错: error : unpacking of archive failed on file /usr/.../...;5d26ff7c: cpio : symlink早前已发现有台机一直在报这么个错误, 一用yum update 就报一堆: Error: unpacking rpm package .
2393 0