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.

Windows has a nice option to its XCOPY command: /D. This copies only files where the source modification time is newer than the destination time. Is there any unix/linux equivalent of this? I'm trying to get a fast copy to my local testing server.

share|improve this question

migrated from stackoverflow.com Nov 5 '09 at 21:36

This question came from our site for professional and enthusiast programmers.

This should be asked on SuperUser as it has nothing to do with programming. –  SLaks Nov 5 '09 at 21:34

2 Answers 2

up vote 5 down vote accepted

I usually do:

rsync -avz /from/where/ /to/dest/

If you want it to delete files that doesn't exist anymore in /from/where add --delete.

It can also be used from different boxes like this:

rsync -avz eromero@mydevbox.org:/from/where/ eromero@mybox.org:/to/dest/
share|improve this answer
Normally I'd add "-e ssh" to that last one. I don't like running an rsync server because it's not secure enough. –  Paul Tomblin Nov 5 '09 at 21:40
I was under the impressions that rsync uses ssh by default. I think you need two colons to specify an rsync server. –  Ryan Thompson Nov 5 '09 at 22:39
Oh yeah, you might want to throw in the --update option, if you don't want to overwrite newer files in the destination, but only older ones. It depends on whether you just want to efficientlysynchronize the two directories, or you want the exact behavior described above, with modification times. –  Ryan Thompson Nov 5 '09 at 22:51
Yeah, it uses ssh by default. Need to add more "options" for rsync. Funny huh? –  Eduardo Romero Nov 5 '09 at 23:14
cp --update src dest

From the man page:

copy only when the SOURCE file is newer than the destination file or when the destination file is missing

share|improve this answer

Your Answer


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.