Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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
1  
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.