The best choice, as already posted, is of course rsync
. Nevertheless also unison
would be a great piece of software to do this job, though typically requires a package install. Both can be used in several operating systems.
Rsync
rsync synchronizes in one direction from source to destination.
Therefore the following statement
rsync -avh --progress Source Destination
syncs everything from Source to Destination. The merged folder resides in Destination.
-a means "archive" and copies everything recursively from source to destination preserving nearly everything.
-v gives more output ("verbose").
-h for human readable.
--progress to show how much work is done.
If you want only update the destination folder with newer files from source folder:
rsync -avhu --progress source destination
Unison
unison synchronizes in both directions. Therefore the following statement
unison Source Destination
syncs both directories in both directions and finally source equals destination. It's like doing rsync twice from source to dest and vice versa.
For more advanced usages look at the man pages or the following websites:
- https://www.cis.upenn.edu/~bcpierce/unison/
- https://rsync.samba.org/
cp
doesn't have an option for this...cp
does have this option. Check my answer below.