avoid rsync deleting vanished files on receiver

Hans-Christian Jehg hc at jehg.dk
Wed Oct 21 04:14:58 MDT 2009

Hello All

I have a rather curious problem. I rsync from a fileserver shared in via 
cifs. This connection sometimes fails (don't worry, that is not the 
question I have).
I am not at all sure where it goes wrong, but in the end the result is 
that rsync thinks certain files has disappeared. It could for instance 
go wrong in the cifs client, but also in rsync when trying to read the 
remote file (I am not using --ignore-errors) if no proper read checking 
is in place (I do not think that this is the case but I would mention it 
My immediate problem is that rsync proceeds happily and deletes any 
vanished files in the end (--delete-after).
rsync stops with exit code 24, but by then the damage is already done 
(files deleted) .

The question is: Is there a way to avoid the deletion when vanished 
files are detected? That would be "no deletion at all" or just "no 
deleting of vanished files".

Best regards

Hans-Chr. Jehg

rsync  version 3.0.2  protocol version 30
Copyright (C) 1996-2008 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
    64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
    socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
    append, ACLs, xattrs, iconv, no symtimes

on Mandriva 2009

 rsync --modify-window=2 --times --omit-dir-times --verbose --stats 
--recursive --partial-dir=.rsync-partial --include "some includes" 
--exclude "*" --compress -e "ssh -o ServerAliveInterval=10 -p 22" 
--delete --delete-after "user at server.tld:~/somedirectory/" 

More information about the rsync mailing list