tags:

views:

43

answers:

2

I have two directories with similar files, (one being a backup), what is a command that allows me to copy over only the files that are different to the backup?

cp -rf firstDir/* secondDir is awfully inefficient, since a lot of the files are the same.

+2  A: 

rsync

will keep the directories the same efficiently. Will work of ssh as well..

Doon
+4  A: 

Rsync is the best way

rsync -va ~/from/ ~/to

note the trailing / on 'from' is important!
v is verbose mode - leave it on until it's working, a is archive = copy all the file info.

Or you can just use the -u (update) flag to cp = only copy newer files.

Martin Beckett