Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 MacbookPro Lion, and I have tried to archive my files that is tried to copy and overwrite if the source is newer than the destination. I tried the following command

cp -u source destination

but it says, -u is illegal. I also did not find --update or -u in the man cp.

Can you please help, what can I do in this situation?

[I have the question moved over here from SO, so feel free to answer it once more. I hope this is the right way of dealing with this]

share|improve this question
Install GNU Coreutils. – Keith Thompson Dec 5 '12 at 23:11
Any love for rsync? – Mike Weller Dec 7 '12 at 13:26
up vote 3 down vote accepted

Probably the easiest solution would be to use rsync. It is a backup application that can do what cp -u does (and much, much more).

The basic usage would be something like :

rsync -u source destination

However, you really should check out the man page because there are MANY useful options.

share|improve this answer

I have installed GNU Coreutils with MacPorts by

sudo ports install coreutils findutils 

findutils are not necessary but they suggested to install it too.

I followed the idea from Keith Thompson, (kudos!). It works greatly, the "advanced" copy command is now:


It does not have a man page, but has a long, man-style help with the --help option.

share|improve this answer
I reassociated this question with your account, so you should be able to comment, accept answers, etc. – Adam Lear Dec 6 '12 at 3:41
Thank you, Anna! – Barnabas Szabolcs Dec 6 '12 at 5:35
If you use zsh this will override highlighting. But it is still awesome. – Fred Concklin Mar 7 '15 at 20:39

You can use the -nt condition:

[[ source/$file -nt destination/$file ]] && cp source/$file destination/$file

Just run this for all files (via a loop or through find).

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.