why --delete dosen't work in my script?

Mike Rubel mrubel at galcit.caltech.edu
Thu Apr 11 09:57:01 EST 2002


> In my backup script I have noticed nothing gets deleted on the remote
> end even though I have --delete and --delete-excluded. Did I miss
> anything obvious here?

Not sure if this applies to you, but...

One thing I noticed about trying to use --delete in combination with -b
--backup-dir is that files do not get deleted if there is already another
hard link to them on the target side.  As I understand it, this is not so
much a bug in rsync as it is a somewhat non-intuitive POSIX behavior in my
operating system (Linux).

Basically, if it can, backup just renames the file instead of copying it.
But on my system, if a and b are both hard links to the same inode,

mv a b

does *not* unlink a!  It has no effect, in fact.

My solution was to make two rsync passes, the first with -b --backup-dir
but no --delete, the second without -b --backup-dir but with --delete.
At some point, though, maybe we should patch rsync to make it do the
intuitive thing in this case.

Does anyone else have experience with this?

Regards,
Mike





More information about the rsync mailing list