rsync only files created or modified after a date and time

15,376

I posted the question again at Server Fault and got the answer I needed.

The --files-from=FILE option can indeed be used with a - so it takes the standard input (where the find command can be used and then piped to rsync). Look at the Server Fault answer for more details.

Share:
15,376
Yanik
Author by

Yanik

Updated on June 04, 2022

Comments

  • Yanik
    Yanik almost 2 years

    The goal is to rsync (or using any other tools that give the desired result) only files that are created or modified after a date.

    I succeeded using this command on OS X 10.6.5: find . -newermt "2010-11-23 16:52:50" -type f -exec rsync -vuptn '{}' ../rsync_test/ ';' I don't think -newermt is working on ohter OS than OS X though.

    The problem with this command is that it runs rsync once per file found and that doesn't seems to be the proper way to do it. I tried to change the last ; with a + so it waits for the entire file list, but it brakes (I did try "+",\+ and other way to escape).

    Background: I am trying to backup my files at a remote location. The files being a lot photos in raw and other format (photographs work. about 30GB per day), rsync'ing though the network would take unusable time due to small upload bandwidth (ADSL sucks). So the idea is to have a lot of disk space at a remote location and transporting new/modified files on a small external hard drive once a week. rsync can then easily be used to add the new/modified files at the remote location. For that I need to sync the new/modified files on an external hard drive during the week so I always have 2 copies of every files either at a remote location for files older than a week or on an external hard drive for new/modified files since the last transport.

    I was going to make this command run every 10 minutes (cron) with the date and time from the last time it was run.

    Can you fix my command? Or do you have an even better solution?

  • Yanik
    Yanik over 13 years
    Thanks for your answer. The platform is OS X, but the answer I found should work on any unix like system. Using --files-from option was the right way to do it as you can see on my answer.