Use “Keep Both” to Merge Same Name Files into Single Folder of Mac OS X
The Mac Finder offers a variety of methods of merging two folders contents together into a single directory. One option allows users to join different directory contents together that contain files with the same names, using the ‘keep both’ function in Mac OS X Finder.
This can be a little confusing at first glance, but after a bit of practice you’ll understand a bit more how the feature works and how you can use it to merge directory contents with files that share the same names together into a single folder, entirely by using the Mac OS X Finder.
If you’re going to try this yourself, it’s strongly recommended to do so with unnecessary files or folders, and preferably make a backup beforehand. The reason is quite simple; you don’t want to accidentally replace essential files or folders while discovering how the “keep both” choice works and behaves.
How to Merge Files with the Same Name into a Single Folder in Mac Finder with ‘Keep Both’
In this example, let’s say you have two folders with contents that share the same name – but the files are different – like 0.png, 1.png, 2.png, etc, thus, you do not want to overwrite any files, you simply want them all to be in the same folder, thereby joining them together and merging the directories into one:
- Select all files from the source folder, then hold down the “Option / alt” key and drag and drop them into the destination folder (remember, the destination folder has files of the same name)
- You’ll get a message saying “An item named ‘file’ already exists in this location. Do you want to replace it with the one you’re moving?” – DO NOT choose Replace as it would overwrite the files
- Instead, assuming you held down the Option key (you can also hold it down after the fact), you’ll see a third option button “Keep Both” – choose this instead (optionally, check the “Apply to All” box if you’re confident you want to keep both of all files and don’t want to approve each one)
The Finder will move the source files into the destination folder and rename them automatically so they do not overwrite one another.
The naming convention is rather basic, it simply appends a counting number to the end of the files coming from the source. Using the aforementioned filename example, that means copying 0.png, 1.png, 2.png, etc into another folder with the same named files will rename them automatically to “0 2.png, 1 2.png. 2 2.png”, and so on.
Because of the naming convention of simply appending a number to the end of the source files being copied, perhaps a better option is to first batch rename the file contents of one folder, and then just drag and drop the newly renamed files into the other folder. In that case, because the file names are different, it will not triggering the ‘keep both’ option at all and the files would drop into the folder as you would moving any other items around. This is often preferable since you can choose the file names yourself rather than going with the naming convention that ‘keep both’ assigns to the files, but it’s really up to the Mac user to figure out what’s best for their situation.
It’s also worth pointing out that you can enable the “Keep Both” Option after the dialog box has been triggered for file copies. If you see a “Skip” option in the dialog instead, hold down the OPTION key to switch to to ‘Keep Both’ like so:
Note: The “Keep Both” choice only appears with identical named files in folders, if the file names are different, the button will not appear, and if you held the Option key it would simply copy the files into the other folder.
Admittedly, the way Finder handles this is a little confusing at first glance, but it works as advertised. For Mac users who are more advanced, turning to the command line and using ditto to copy files between directories is another excellent option, or even using ditto tomerge directories in Mac OS X.
And yes, there is a ‘merge’ option hidden in the Finder, but it’s behavior is sometimes even more peculiar than “Keep Both”, so we’ll focus on explaining that in another article.
What do you think? If you have any tips or tricks, share in the comments!
I almost never want to “keep both” What I do want to do is “skip” identical files. Apparently you can do this with apple but as a prior poster said “it’s clear as mud”
We have just started having a problem on our PC server that when people go to overwrite a folder it won’t let them. Merge seemed to work but now I am worried that as one of your co tributary said it won’t merge at deep level.
Is this a Yosemite/El Capitan bug because it only seems to have manifested in the last few weeks?
The Merge option is one the most limited and silly options in OSX. I’ve lost hundred if not thousands of files because this option doesn’t not merge at deep level. Windows is absolutely more clever copying files since windows 98… bad bad.
What I want is a way to merge folders, automatically skipping the files that are already in the destination.
Too often I end up having to abort the entire copy because of one dupe, or else replace the existing dupe(s) with exact copies, which takes a long time and monkeys with modification dates.
Is there a way to do this with Finder, cp or ditto?
I use Keep Both often, and I also use Batch Rename often which I think, as you outline, is a better choice.
Then the third option is the “Merge” option, which is hidden probably because it’s behavior is weird and requires the folders to have the exact same name irregardless of the folder contents. From Apple description of the Merge feature:
“Merge two folders with the same name
If you have two folders with identical names at two different locations, you can merge them into a single folder.
Hold down the Option key, then drag one folder to the location that contains a folder with the same name. In the dialog that appears, click Merge.
The Merge option appears only if one of the folders contains items that are not in the other folder. If the folders contain different versions of identically named files, the only options are Stop or Replace.”
Clear as mud, right? Much room for improvement when merging folders together in Mac OS, where OS X 10.11 is the same.