Server Fault is a question and answer site for system and network administrators. 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

Is there a way to do a cp but ignoring any files that may already exist at the destination that aren't any older then those files at source.

Basically I want to copy the contents of one disk to another, then run the copy again but only updating new files or files that have been updated on the source side.


share|improve this question
up vote 12 down vote accepted

use this:

rsync -a /source /destination

Alternatively, you can get more details with a few other flags like -v or --progress.

share|improve this answer
That did it, many thanks! :-) – Ben Everard Apr 17 '12 at 13:33
I want to add that you can use rsync over the network also. It's particularly easy to do so using ssh. For either the source OR destination, prepend it with user@host: and it will do just that. This will act as a replacement for scp – UtahJarhead Apr 17 '12 at 13:50

Use rsync, problem solved.

rsync -av /srcdir /tgtdir
share|improve this answer
Thanks for your answer @ScenW :-) – Ben Everard Apr 17 '12 at 13:33

from the cp manpage:

   -u, --update
          copy only when the SOURCE file is newer than the destination file or when  the
          destination file is missing
share|improve this answer
Just found this too, was looking at the man page for the wrong version of cp. D'oh! – Ben Everard Apr 17 '12 at 13:34

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.