Merging Folder Contents in OS X
Although I've been an Apple convert and dedicated OS X user at home for a reasonable amount of time, I still get caught out occasionally by making assumptions with my "Windows" brain, and the one that has recently cropped up and bitten me in the arse is Finder's folder copy function.
I have two Canon cameras; a dSLR 40D and a compact IXUS85, both of which I used to take pictures of our recent snow and both of which it turns out store their photos in a folder called "100CANON" on their respective memory cards.
I didn't really think anything of it when I plugged both cards in my USB reader, the first folder copied to the desktop fine. Then when I went to copy the second, I got the following dialog:
Being used to various Windows platforms in the past and at work, I just clicked 'OK', assuming that I'd end up with a single folder on my desktop containing both sets of files. I knew there wouldn't be any filename conflicts as my 40D produces .CR2 raw files and my IXUS85 .jpgs, but once the operation had completed, I opened the folder and found no sign of my .CR2s! The copy had in fact done exactly what the dialog said; it had replaced the old folder with the new one! The original CANON100 folder containing my CR2s had gone completely, no Trash bin, no nothing!
After some furious web searching, this actually turns out to be quite a contentious issue in Mac-land and has in fact been a 'feature' of OS X's Finder all along. The web is full of horror stories of people losing gigs of carefully organised mp3s, photos, whatever, when they decided to copy an indentically named folder from their usb key, expecting the contents to merge with their existing collection. Due to the fact that OS X treats all files and folders as objects, this behaviour makes sense, it's just not what I initially expected.
Luckily, Apple do provide an application to merge folders called FileMerge as this MacWorld tip from 2006 points out. To use it you'll need to install Xcode, and it is intended to be used for comparing files, but as the article points out, it can also be used to compare folders and will happily point out any discrepancies between the contents of the two and allow you to merge them.
So I guess the lessons I learnt from this are;
- Never 'Move', always 'Copy' and check my files are where I want them before deleting the originals, and
- Use FileMerge to merge the contents of directories.
Fortunately, I didn't lose too much, the flurry of snow balls flying about at the time meant I was quite reluctant to bring my 40D out from under my coat!