Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a server from which I want to copy files and directories to a local destination. The local destination does not have any of the files or directories on it. Instead of copying all files on the server to the local machine, I would like to only update any new files that are put on the server to the local destination.

Thus, I'm assuming that a time stamp of some sort could be used to filter the preexisting files for a rsync transfer. How would I go about doing this?

share|improve this question

One of the ways to do that would be to use rsync with find.

rsync <options> <source> <destination>
rsync -azv username@server:'$(find source_dir/ -mmin -120 -type f)' destination_dir/

This command will compress and archive files found under source_dir on server that were modified in the last 2 hours and rsync them to destination_dir (local destination). You may have to modify this command to suit your needs.

share|improve this answer
This breaks if files have a space in their name. – slhck Jul 21 '13 at 10:34
It would be better to use something like --files-from parameter, this command smells like it's just waiting to blow up. – Bobby Jul 21 '13 at 10:53
So are there any other methods to go about doing this? – arete Jul 23 '13 at 7:00

You must log in to answer this question.

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