list files to delete, rather than deleting them with --delete?

Dan Crosta dcrosta at
Wed Nov 16 23:28:07 GMT 2005

I'm trying to design a daily backup system based on rsync that will
keep deleted files for N days after they went missing, and am
wondering if there's a way I can coax rsync to give me a list of files
that are missing on the source relative to the destination, so that
they can be later deleted (ie after the N days). I envision a system
like this:

rsync [args] --list-of-missing=FilesToDelete [src] [dest]

and then process ToDelete like so (supposing N is 3):

1. mv ToDelete-2 ToDelete-3 && mv ToDelete-1 ToDelete-2
2. cat ToDelete | grep -vf ToDelete-2 -f ToDelete-3 > ToDelete-1
3. delete from dest files mentioned in ToDelete-3
4. rm ToDelete-3

So I realize I can use --dry-run and --delete, and capture and parse
the output of rsync, but then I've spent a whole lot of time building
file lists and pretending to transfer files (or maybe even doing all
the checksumming and whatnot -- does --dry-run still do all that?),
and then I need to do it again to actually do the backup. The backup
runs about 60 gigs, and takes around an hour to do once (for the
incremental backups -- the inital takes quite a bit longer), so I'd
rather not have the system do it twice, if avoidable.

Is there any way to make this work? Or am I barking up the wrong tree
with rsync for this kind of backup scheme? Or is there another way to
accomplish the same goal (keeping deleted files from src in dest for N


More information about the rsync mailing list