Alex Rivera | Logout

How to emulate 'cp --update' behavior on Mac OS X?

Asked 2009-07-15T16:33:23.040
13

The GNU/Linux version of cp has a nice --update flag:

-u, --update copy only when the SOURCE file is newer than the destination file or when the destination file is missing

The Mac OS X version of cp lacks this flag.

What is the best way to get the behavior of cp --update by using built-in system command line programs? I want to avoid installing any extra tools (including the GNU version of cp).

Edit
Report

1 Answer

19

rsync has an -u/--update option that works just like GNU cp:

$ rsync -u src dest
answered 2009-07-15T16:58:46.280

Your Answer