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.

Is it possible to have rsync transfer all files in a directory that have changed or have been created? I don't need something as sophisticated as a CRC diff check; files with different timestamps and/or file sizes count as changes.

I get the impression from the man page that it should be possible, but I need a little guidance on what set of parameters to pass rsync.

share|improve this question

2 Answers 2

up vote 14 down vote accepted

To just sync two directories:

$ rsync /source/path/* /dest/path/

Or if you want to do a whole tree:

$ rsync -a /source/path/ /dest/path/

"-a" specifies "archive" mode, where it duplicates the tree as closely as possible.

I like to add the flags v and P in there so I can watch it work:

$rsync -avP /source/path/ /dest/path/

"-v" turns on verbose mode, so you can see what it's doing (it lists the files as they copy), and "-P" enables progress, so you can see how long it's taking to copy each file (percentage copied, time remaining, etc), and allows you to see how far through the copy you are.

share|improve this answer
2  
...and perhaps add the z flag to use compression for the transfer –  Linker3000 Mar 7 '11 at 21:47
1  
...if you're transferring to a remote location –  Majenko Mar 7 '11 at 21:50

This is how rsync works by default (at least on Linux). From the man page:

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.

share|improve this answer
    
Ah, I had confused myself by misreading the documentation. Thanks :) –  instanceofTom Mar 7 '11 at 21:48

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.