I have 2 folders , A and B. they are similar, but there are some files in A that are not present in B. what's the best way to copy only the new files in A into B, without changing the existing files in B?

link|improve this question

71% accept rate
feedback

2 Answers

You can also:

cd A
find . -print | cpio -pd ../B/

Or you can:

cd A
rsync -a --update . ../B/

And you can probably do something similar wth tar.

link|improve this answer
With rsync you'd want --ignore-existing if you don't want to replace the files that have the same names but different contents. – DerfK Nov 20 '10 at 4:26
feedback

cp with -n.

link|improve this answer
This is there on my Ubuntu system, but man cp on my Centos 5.5 system seems to be missing it. – ehsanul Nov 19 '10 at 23:59
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.