rsync files with certain mtime

Dag Wieers dag at wieers.com
Sat Feb 18 17:00:07 GMT 2006


On Fri, 17 Feb 2006, Matt McCutchen wrote:

> On Fri, 2006-02-17 at 14:55 +0100, Mario Ohnewald wrote:
> > How would i rsync all files which are older than X-Days? I am missing
> > some kind of -mtime option. Since this is quite common for backups i am
> > wondering how you are doing this kind of stuff.
> 
> Rsync doesn't have an option to transfer only files with a certain range
> of mtimes, and in general I think such fancy file selections should be
> made outside of rsync and passed to rsync using --files-from.  Try this
> incantation to transfer files at least 7 days old:
> 	(cd src && find . -atime +6 -print) | rsync --files-from=- src/ dest/

Few people know you can do this in bash as wel:

	rsync --files-from=<(find /../src -atime +6 -print) src/ dest/

Not that it matters in this case, but when you are to provide different 
files, this comes in handy (especially if you have to repeat the same set 
of commands on the commandline).

Kind regards,
--   dag wieers,  dag at wieers.com,  http://dag.wieers.com/   --
[all I want is a warm bed and a kind word and unlimited power]


More information about the rsync mailing list