using rsync for mirroring: deleted files from source and kept
in dest, better handling?
Matt McCutchen
matt at mattmccutchen.net
Sun Mar 2 20:45:24 GMT 2008
On Sun, 2008-03-02 at 15:24 +0100, Rsync user 123 wrote:
> I'm starting to explore rsync to mirror some
> directories from a disk to another locally.
>
> If I understand it right, if I don't include any
> --delete* parameter, when updating the copy, if some
> files have been deleted from the source directory
> they're not deleted from the destination directory.
>
> That's exactly what I need, but I'd like those files
> be treated differently, I haven't decided how yet, but
> at least I'd like to know they've been deleted in the
> source folder.
>
> Is there any option I'm missing for that? Any plugin
> or extension that I'm failing to find on the net or
> anything?
Two approaches you might consider:
- After your main rsync run, do an additional run with --dry-run and a
--delete* option to make a list of destination files that have been
deleted from the source, and save this list for future reference.
- Use --backup with a --backup-dir to have rsync move the extraneous
destination files to a parallel directory tree instead of deleting them.
That way, the destination faithfully represents the source, but you can
retrieve the deleted files if necessary. (Note: overwritten destination
files will be backed up just like deleted files.)
Matt
More information about the rsync
mailing list