Sunday, April 3, 2011

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

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).

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

    $ rsync -u src dest
    

0 comments:

Post a Comment