3
1
Here's the best way to describe this:
dirA
dir1
file1.txt
file3.txt
dirB
dir1
file1.txt
file2.txt
I want to copy the contents of dirB into dirA. cp -R dirB/* dirA
would delete dir1
and copy the files, resulting in:
dirA
dir1
file1.txt
file2.txt
But I want to merge them (like it would on Windows) and end up with:
dirA
dir1
file1.txt
file2.txt
file3.txt
Suggestions? I've tried ditto
, but that seems to ignore the recursive part and just dump all the files in the top-level folder.
http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/cp.1.html is the man page for cp. – MDMarra – 2009-10-26T22:01:08.640
1How does Windows merge those two files with the name
file1.txt
? – Arjan – 2009-10-26T22:01:50.9331I just tested cp -R on Snow Leopard and it will do just what you want. It will overwrite the files in dirA that have the same name but it won't delete any files. – Raynet – 2009-10-26T23:12:10.293
thanks Raynet, I didn't think I was getting that result but I'll check again.
the issue here involves subversion. I need to dump a bunch of folders/files into a version-controlled folder, but it needs to leave all existing files there so it doesn't clobber the .svn files. – SkippyFlipjack – 2009-10-26T23:38:28.477