default mac os x finder merge behavior deletes your files

The default folder-merge behavior in Mac OS X is to erase the existing folder, deleting all its files rather than offering to merge them intelligently. Windows and Linux file managers have offered folder-merging for decades, but Macs still don’t.

There’s a hidden merge option in the Finder, but it only works sometimes. Apple also includes a terminal command to merge folders a different way. If you’re a Windows or Linux user using OS X, this is pretty jarring.

The Finder’s Broken, File-Eating Behavior

This problem occurs when you try to move a folder into a location where there’s already another folder with the same name. On Windows and Linux, file managers try to handle this intelligently. They’ll combine the files in the two folders into a single folder with the same name.

If there is a file conflict, the file manager will ask you what to do with that specific file. If you’ve used Windows or Linux, you’re probably familiar with this behavior. You’ve probably never thought much about it, because it just works.

The Finder on Mac OS X isn’t so smart. By default, it just offers two options — Stop or Replace. Stop doesn’t do anything, while Replace replaces the old folder with the new folder. Replacing the old folder actually deletes all files in the old folder. The Finder doesn’t offer to merge the folders.

RELATED: How to Back Up Your Mac and Restore Files With Time Machine

Yes, you’re reading that right — try to merge a folder like you would on Windows or Linux and you’ll lose all the old folder’s files if you click Replace without reading the dialog. We hope you had some recent Time Machine backups before you started moving folders around on Mac OS X!

If you ever see this dialog while trying to move one or more folders, you should probably just click Stop. It probably won’t do what you want it to do.

How to Merge Folders in the Finder

The Finder does actually have a folder-merging feature, but it doesn’t offer it when you might want it. Instead, you need to use a secret handshake to access it.

Mac OS X 10.7 Lion — released in 2011 — added a hidden Merge option. To access it, you have to hold down the Option key as you drag-and-drop a folder into the same location. If you do this, you’ll see a dialog with a Merge button and you can click it to merge folders like you would on Windows or Linux.

Problems arise when you have files with the same name in each folder. Mac OS X will offer one option to help you manage this — a “Keep Newer” button that overwrites the older versions of the all files with the same name with the newer ones. There’s no way to skip these conflicts or keep the older files, and there’s no helpful tool that will let you compare sizes and other information. It’s all-or-nothing.

The “Keep Newer” option only appears if the folder you’re moving contains the newer files. If the folder you’re moving contains the older files, then the Merge option won’t appear — even if you hold the Option button.

Perhaps the Merge option is so well hidden because it doesn’t work very well. It’s kind of embarrassing.

How to Merge Folders With the Ditto Command

To help you merge folders properly, Apple added better folder merge functionality to a terminal command called “ditto.” (Why they didn’t just fix the Finder, we’re not sure.) The ditto command is an improved version of the standard Unix cp command, which you could also used if you like.

Unlike the Finder, ditto automatically merges folders. As its manual page puts it:

“If the destination directory already exists then the source directories are merged with the previous contents of the destination.”

To use ditto, you’ll need to open a terminal — press Command + Space, type Terminal into the Spotlight search dialog, and press Enter.

The ditto command uses the syntax ditto /path/to/source/folder /path/to/destination/folder. So, in our example here, we have a folder named “Test” stored on our desktop, and another folder named “Test” stored in our Downloads folder. We’d run the following command to merge them:

ditto -V ~/Desktop/Test ~/Downloads/Test

(The -V part of the command is optional, but it lets us see what ditto is actually doing. Feel free to omit it.)

Unlike the Finder, the ditto command forcibly overwrites the contents of the destination folder with the contents of the source folder. Even if the source folder contains older files than the destination folder, the destination folder’s conflicting files will be overwritten with these older files.

How to Merge Folders, Windows or Linux Style

You’ll need a third-party utility to merge folders like you would on Windows or Linux, with prompts for each individual file conflict and the ability to make choices about which files you want to keep. We searched high and low looking for good, free software that would compare file conflicts and allow you to choose intelligently, but we didn’t find any good ones. Please leave a comment if you found a free utility that works well!

This feature is available in paid software. We tested Cocaotech’s Path Finder, a Finder alternative, and found it offered a merging feature that works like you’d expect it to. At $40, that’s an expensive folder-merging feature, but maybe you’d find its other features useful, too. We’re sure other paid applications offer similar features.

You could always just open up both folders and move the files inside one folder to the inside of the other folder, going through file conflicts in the Finder that way. This won’t be a good option if you have several levels of nested folders, however — that’s a lot of work to do recursively.

This article was written about OS X 10.9 Mavericks, so hopefully Apple will add proper folder-merging in the future. But don’t hold your breath — merging folders is a pretty complicated power-user feature Apple doesn’t seem concerned about.

Profile Photo for Chris Hoffman Chris Hoffman
Chris Hoffman is Editor-in-Chief of How-To Geek. He's written about technology for over a decade and was a PCWorld columnist for two years. Chris has written for The New York Times and Reader's Digest, been interviewed as a technology expert on TV stations like Miami's NBC 6, and had his work covered by news outlets like the BBC. Since 2011, Chris has written over 2,000 articles that have been read more than one billion times---and that's just here at How-To Geek.
Read Full Bio »