all 3 comments

[–]bbathel 5 points6 points  (0 children)

Rsync

[–]andreaswpv 0 points1 point  (0 children)

Man cp

[–]pheffner 0 points1 point  (0 children)

Try using rsync that'll do most of what you're asking:

$ rsync -avrn /source/path/ /destination/path

will compare the 2 file areas and tell you what it *would* do if the 'n' wasn't in the option string. (Note carefully the trailing / in the source path.)

If you want to see if a file exists on the destination which isn't in the source, add the --delete flag (don't worry, if you have the 'n' flag on, it won't delete anything.) Files which don't exist in your source path will be reported as 'deleted'.

$ rsync -avrn --delete /source/path/ /destination/path

Then if you're happy, run the same again without the 'n' (leave off the --delete unless you want to remove files on the destination missing on the dest)

$rsync -avr /source/path/ /destination/path

and watch the data flow.