Every now and then I find myself in a situation where I have a folder (I’ll call it source
) of files and nested folders, possibly many levels deep, that I want to copy into another folder (which I’ll call target
). target
already contains some of the files and folders I’m copying, and it also has files and folders that are not present in source
.
Simply copying source
to target
’s parent folder in the Mac OS X Finder will replace everything in target
with the contents of source
. This is not always what I want, and in my opinion it’s one of the biggest flaws of the Mac OS X Finder. Not just Mac OS X actually – back in the pre-Mac OS X days there was a utility called Speed Doubler that patched the Finder to add a smart replace option when copying files.
It’s possible to manually open each folder and their subfolders and copy just the files, but it can be very tedious. There are also third party software options that let you merge files when copying, and if you have Apple’s Developer Tools installed there is the FileMerge utility.
However, you can open a Terminal window and copy the files from the command line, which saves you from installing extra software. Since I keep looking up the syntax every time I need to do this I decided to document it here for future reference.
Read full post
Posted in Mac.