In Linux Copy File and Overwrite Only If Target Is Older [Duplicate]
This Question Already Has Answers Here: Copying a File Only When It Is Newer Than the Destination (4 Answers) Closed 7 Year's Ago. How in Linux Using Cp One...
How in Linux using cp one can copy file to destination, but if destination exists, then overwrite only if destination is older than source?
cp -f always overwrites, but overwrite is needed only if target is older than source.
cp -u
According to the cp man page, -u will only overwrite file if the destination is older than the source.
It appears the -u option is not available for scp, so if you need to do it on a remote host, use rsync. By default, rsync skips files that have the same size, name, and last modified time. Rsync also has a -u option to skip destination files that are newer.