copy newer files only

I have discovered that the cp command in Terminal does not support the -u flag which will copy files from one directory to another but only if the source file is newer version of the file or if the file does not exist in the destination directory.


Does anybody know how to do this at all?

Many thanks

Posted on Nov 24, 2014 9:14 AM

Reply
2 replies

Nov 24, 2014 1:49 PM in response to ArtySin

You are thinking of the GNU cp command commonly found in Linux distributions (cp on other Unix platforms does not have a -u option, such as Solaris, AIX, Mac OS X, etc...).


However, if you really want cp -u, you can get the GNU sources and build your own cp command, although I strongly suggest NOT replacing the Mac OS X cp command, but rather put your version in a different directory and include that directory in your PATH before /bin


As Tony T1 suggests you can get the copy only newer files via rsync, or use a utility such as Carbon Copy Cloner that uses rsync under the GUI to do its transfer work (CCC can be configured to just copy select files and folders, besides its more common disk cloning services).

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

copy newer files only

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.