I am using rsync rsync $source $destination. How do I rsync based on modified time? I see an option for file size --size-only but nothing for modified time?

  • 4
    What is it that you want to do? Do you want to update files based on only modified time? Does --update do what you want (check the manual)? What do you mean by "based on modified time"? Can you give an example?
    – Kusalananda
    Dec 17, 2018 at 19:37
  • 1
    Why would you want to worry about modified time? rsync -a (or rsync -t) will propagate times to the target and on future copy attempts simply ignore those that haven't changed. Dec 17, 2018 at 22:04
  • Just wanted to rsync files who's modified time changes. I think that is the default along with size. But I was unsure. Dec 18, 2018 at 15:28

2 Answers 2


Am I understanding your question correctly? 'Modified time' is one of the default criteria, when rsync decides if the copy should be updated or not.

From man rsync

Rsync finds files that need to be transferred using a "quick check" algorithm (by default) that looks for files that have changed in size or in last-modified time. Any changes in the other preserved attributes (as requested by options) are made on the destination file directly when the quick check indicates that the file’s data does not need to be updated.


The easiest way would be to runthe following:

rsync -an /path/to/source /path/to/destination

Then verify that only the desired files are going to be transferred. Once you have verified this run the above command without the -n flag and you will accomplish your goal. As pointed out by user roaima there is another flag that will accomplish your goal and that is -t. Using the -a flag is equivalent to -rlptgoD. Read all about rsync usage here.

An alternative way would be to use the command from this answer:

 find /path/to/source -file -mtime +3 -exec rsync {} /path/to/destination \;

So you use find to locate all files at a given $SOURCE that have a modified date as of 3 days ago. You can change -mtime +3 to however many days back you want to go. Once you have identified all files at the given $SOURCE you then execute rsync (with whatever desired options) to your $DESTINATION.

  • 2
    Simplest would be rsync -a (no find) and let the utility do what it does well. But it really depends on the reason for the OP to want to limit by times in the first place. Dec 17, 2018 at 22:04
  • @roaima You are right, upon review this answer is pretty sloppy. I use super specific flags with rsync depending on the context so I forgot that default rsync does on a practical standpoint what OP is asking. The find command is if they need to look at files modified at specific times. I will clean this up.
    – kemotep
    Dec 17, 2018 at 23:11

Not the answer you're looking for? Browse other questions tagged .