Delete file on destination only if source was delete at least X days before.

Ercolino de spiacico bellocarico at hotmail.com
Sun Nov 27 09:47:57 MST 2011


Hello everybody,

I've been looking for a way to use rsync with the --del option but checking the data of 
the file as well.

What I'm after is a way to backup NAS1 to NAS2, literally copying everything, but asking 
rsync not to delete data on NAS2 not present on NAS1 if the source was removed less than 
e.g. 60 days ago.

Perhaps a cross checking between the file/dir date and the system date or something?

The reason for this it's pretty obvious, how many time did we delete files by mistake?
So a X days buffer would work well in my case.

At the moment I have cron 2 jobs, one copying (running every day) and the other 
copying+delete (on the 1st of the month only), it somehow does the job but there's a risk 
to delete something on the 31st and not have a backup available any more the very next 
day.

Thanks!


More information about the rsync mailing list