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

Kevin Korb kmk at
Sun Nov 27 10:47:10 MST 2011

Hash: SHA1

Rsync has absolutely no knowledge of when a file was deleted.

Perhaps you are looking for something like --backup and --backup-dir
to temporarily preserve files instead of deleting them (then deleting
them with a simple rm -rf later)?

Or maybe you should consider an rsync --link-dest based backup system
instead of a simple mirroring that will allow you to keep many
complete old backups with minimal increase in disk space usage.

On 11/27/11 11:47, Ercolino de spiacico wrote:
> 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!

- -- 
	Kevin Korb			Phone:    (407) 252-6853
	Systems Administrator		Internet:
	FutureQuest, Inc.		Kevin at  (work)
	Orlando, Florida		kmk at (personal)
	Web page:
	PGP public key available on web site.
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla -


More information about the rsync mailing list