--delete and explicitly listed files

Igor A. Nesterov igor.nesterov at usa.net
Thu Sep 30 00:07:28 GMT 2004

It is my understanding after reading all manuals and postings that 
--delete only works, when rsync is doing recursive dir-to-dir 
synchronization. Like in the following example

local host:

remote host:

If we do [CASE 1]

rsync -rR -v --delete /dir/dira /dir/dirb remote:/

we have it right

building file list ... done
deleting dir/dira/file1
wrote 664 bytes  read 846 bytes  232.31 bytes/sec
total size is 537585  speedup is 1.21

But if we do the same with files explicitly listed [CASE2]

rsync -rR -v --delete /dir/dira/file1 /dir/dirb/file2 remote:/

we have an error

building file list ... link_stat /tmp/dira/file1 : No such file or directory
IO error encountered - skipping file deletion
wrote 652 bytes  read 846 bytes  230.46 bytes/sec
total size is 94186  speedup is 62.87
rsync error: partial transfer (code 23) at main.c(578)

It's an rsync version 2.5.5

I can see the difference but at the same time I do not see a reason why 
--delete option should not work if files are explicitly listed. If not 
--delete, then maybe some of its variants, like --delete-args. Here is a 
real-life example, which creates a great headache for us.

In our production environment we heavily rely on rsync. We are required 
to synchronize a working host with disaster recovery host (dr) every 15 
minutes or so. 'synchronize' means that a large number of scattered 
state/log/config files has to be copied to dr host. An overall size of 
all files is pretty high. Given the required frequency of updates rsync 
is an obvious choice. But we are out of luck with it! It is important to 
understand that the files are scattered over the filesytem. There is no 
chance to sync it dir-by-dir. File list is cosntructed from different 
sources: predefined chunks, outputs from 'find' with wildcards, and so 
on. When the list is ready, we would like to sync it with something like 

rsync -aR --delete ${list} dr:/

I would expect that in this context rsync will "synchronize" 
non-existing files from the list by deleting them on dr system. But it 
does not do so. Moreover, rsync fails with an error code, which we are 
unable to suppress. It's not an error at all in our case!

Well, this posting is actually a question to rsync authors. If you have 
a good reason not to expand --delete functionality to explicitly listed 
files, then maybe you have in mind some workaround for situations like ours?



More information about the rsync mailing list