cp -u is illegal on mac. What are the alternatives?
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.
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
).
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:
/opt/local/libexec/gnubin/cp
It does not have a man page, but has a long, man-style help with the --help
option.