macOS 101: The Many Ways to Merge Folders on the Mac

One of the shortcomings of the Finder is the lack of options when it comes to managing folders and their content. While there are a few issues that are often mentioned, the one we’re going to address here is how to merge folders that have the same name.

It seems to happen quite often when you have a project you’re working on in two different locations, say at home and at work. Or perhaps you’re working on a project on just one Mac, but you have a folder for the currently active project, and one for the updates you’re planning to perform.

In either case, the goal is to unite the two folders so they contain all of the files found in each one. When there are two files with the same name, you want the most recent version to be used, and the older one to be replaced.

Seems simple enough, but for a long time this type of basic file/folder manipulation was beyond the capabilities of the Mac’s Finder. Of course, there are quite a few third-party utilities that can perform the merge function for you; there are even some Apple utilities that can assist in this undertaking. But we’re going to start with just the Finder we use every day, and try out some of its merging options.

Options When Moving Files
When moving or copying files (we’re primarily going to refer to moving files, though you could also be copying files) from a source folder to a destination folder, there are a number of options for how file merging is performed.

The first option is none at all. If the files you’re moving are unique, that is, the names don’t match any of the files currently in the destination folder, then no merge option is presented, and files are simply moved to their new home in the destination folder.

(The default options for merging files conceal a fourth option that can be accessed under certain conditions.)

When one or more file names in the source folder match one or more file names in the destination folder, then the Finder will present four options in a dialog box for how to merge the files into the destination folder.

Actually, you’ll only see three of the four merge options; the last one is hidden, but we’ll show you how to access it.

Keep Both: When a file name matches, both versions are kept in the destination folder, with the file that came from the source folder having a version number appended to its name. As an example, if both the source and destination folder had a file named ExampleFile, then after the move, the destination folder would contain files named ExampleFile and ExampleFile 1.

Stop: As the name implies, selecting this merge option halts the merge function entirely; no files will be moved from the source and no files in the destination will be replaced.

Replace: Selecting the Replace option will cause any file in the destination folder that has the same name to be replaced by the file from the source folder.

(The Skip option replaces the usual Keep Both button provided there are multiple files being moved and you hold down the option key once the dialog box is presented.)

Skip: This is the hidden option that can be revealed by holding down the option key when the dialog box is present. Skip replaces the Keep Both option and allows you to skip over the currently listed file. This is the same as the Stop function, but only applies to the currently listed file in the dialog box. You can use Skip when you spot a file during the merge process that you didn’t mean to move.

Options When Merging Folders
So far, we’ve looked at the options available when moving one or more files between folders. But there are different options when you find yourself moving folders with identical names into a folder.

In this example, you’re moving a folder into a folder that already has a folder with the same name. That’s a lot of items called folder, so let’s add some names to make it easier to follow along.

In this example, you have two folders named Project X, a super-secret assignment you’ve been working on. You have two folders with the same name because you’ve been working on this project on two different computers, and now you want to merge the two folders into one, keeping the most recent versions of any files they contain, and discarding older versions.

While there are quite a few syncing apps that can do this for you, the Finder can also take care of this basic task.

For the Finder to perform the merge you’ll need a destination folder to hold the merged folders; for this example, we’ll simply call this folder Merged. The two source folders have the same name, Project X, but they’re located in two different locations on your Mac.

Start by moving one of the Project X folders to the Merged folder; either one will do.

Hold down the Option key while you drag the second Project X folder onto the Merged folder.

(When you move a folder to a location that contains a folder with the same name, the Finder will present a number of merging options.)

A dialog box will open, presenting two or three options, depending on the state of the files in each Project X folder:

Stop: This will halt any move process, leaving both folders untouched.

Replace: This will cause the folder already present in the target folder (Merged) to be completely replaced by the one you’re moving.

Merge: This option will combine the contents of both folders, keeping the newest version of files with matching names, and preserving all files with unique names. The end result will be a folder that contains the newest version of each file from the two folders.

Merging Subfolders
When merging folders, any subfolders will also undergo the merge functions, with this caveat: The Finder only offers the merge option if there are changes in the top-level folders. In this example, if the Project X folders are identical, with the same names and modification dates, even though there are changes in one or more subfolders, the option to merge will not be presented.

Because it’s not easy to know if there are changes within subfolders, you can use the Ditto command to perform the merge and ensure that all files are properly copied no matter where they reside.

Use Ditto to Merge
If you find yourself in the situation where only subfolders have changes that need to be merged, you can use the Ditto command from within Terminal. Ditto will perform a recursive merge, starting at the top level of the folder, merging all the files, and then continuing on to each subfolder it encounters. The end result is that all files and subfolders in the two Project X folders will be merged.

(The Ditto command can merge folders and all subfolders they may contain.)

To use Ditto, follow these instructions, once again using Project X as the example:

Launch Terminal, located at /Applications/Utilities/.

In the Terminal window that opens, enter the following after the Terminal prompt:

Ditto source_folder destination_folder

Where source_folder is the pathname to one of the Project X folders, and destination_folder is the pathname to the other Project X folder.

An easy way to enter the pathnames is to open a Finder window and navigate to the location of the first folder, and then drag it onto the Terminal window. Terminal will convert the dragged folder into the pathname for you.

Press the space key once after you drag the first folder into Terminal, and then repeat the process with the second folder, dragging it onto the Terminal window.

Once both folders have been dragged onto the Terminal window, press the return key to execute the Ditto command.

The results of the Ditto merge will be present in the second folder (destination_folder) you dragged to the Terminal window. You can view the results in the Finder.

Note: We will update once we confirm this tip is compatible with macOS Mojave


LEAVE A COMMENT


  • I had the same problem and realized one was in Finder>Documents and the other in the Cloud drive. I copied all info from the Cloud folder and pasted it in the Finder>Documents. Still has “clouds” next to the ones I copied. Will address that later, as I believe anything I try to save from this point forward will be in Cloud.




  • Wow what a pain in the ass just to merge folders with dissimilar files!

    Sorry but in Windows this takes 1 second, and it looks WAY DOWN at files BURED in subfolders.

    Iʻm trying to merge 2 huge folders of b-roll into one, but because the top level folders have identical names, I donʻt get prompted to “merge”.

    The differences between the two giant folders are buried down in sub-sub-sub folders…is Mac OS really too stupid to look for anything dissimilar below the names of the top folders???

    And having to use terminal and type in commands & filepaths for something like this is ridiculous.

    Sorry but Windows > Mac on this functionality.




  • I just did a ditto from source to destination. In theory the destination should have all the files from source and update any newer files from source to destination.

    Then option-drag source to destination and and it takes quite a while and tells me:

    A folder named “Foo” already exists in this location. Do you want to merge or replace it with the one you’re copying?

    Merge will combine the two folders, preserving all the newer items such as “DSCF002555.JPG.zip” and 355 other items.

    And note that the root the destination “Foo” and the source “Foo” both have 58 items.

    This suggests the Finder option-drag does in fact drill down into subfolders (macOS Mojave 10.14 Beta (18A347e))

    And given that the DSCF002555.JPG.zip file is identical at either location, it suggests the Finder merge is also broken.

    A second option-drag after the first one completes with a merge results in offering a merge again with a different dialog. Ok, maybe that is doing a ditto.

    Adding a folder in the Destination folder called “I’m in Destination” and a folder in the Source folder called “I’m in Source”, then option dragging source to destination offers a merge again with the original message… and indicates again that DSCF002555.JPG.zip is newer at the destination.

    DSCF002555.JPG.zip is in a folder named “Flyer” which is in a folder named “Innovation” which is in the destination folder.

    It does drill down but with a dull drill bit apparently




  • Looking for a file or data base merge solution between high sierra and sierra iOS. Im being told that I cannot migrate phots for example from high sierra back to sierra. Can I export them and convert them? Need an over all solution as I reverted back to sierra after a nightmare experience when updating to high sierra and losing tons of files randomly. I have no idea what I have lost




  • I didn’t know about the Ditto command. I will try it. Thanks!




  • I created a little app in Automator that streamlines the ditto process without needing to open a terminal window. Double-click the app, get a finder popup for the source, then a finder popup for the destination, and done. Works with folders with different names, and to an NAS (for my setup at least). I’m not very well versed in Automator so it could probably be slicker, but it works like a champ. I’d be happy to share it but I don’t know how to do it here.




    • Hi Jason, to share the app I guess you can put the automator file (or a compressed file with it) in any cloud, say Dropbox, and share here the link to that particular file.

      I’d be happy to help you do it, and happy to get the workflow too… ;-)




    • Jason I am very interested in finding a solution to merging folders and sub folders and files. Is there a way we can connect via phone or email? Ive spent three month now with tech support high level at Apple and been in a continuous loop where each of the the 7 techs had contradicted themselves. The latest example was today when after two hours i was told that the ditto command only replicates files and the option key with drag and drop will not merge subfolders. I get a different explanation with every tech i seal to, very unsettling and scary. kathy




      • Thats ridiculous how much time youʻve spent with this…..did you ever even find a a solution??

        Iʻm in the same boat, all my dissimilar files are buried in subfolders, so the option drag doesnt work

        Windows does this so easily btw….just drag, drop & get prompted to merge. It will only move over the dissimilar files buried all the way down through all of your sub-folders. Had no idea Mac OS struggled with this!




    • Hi, sorry I didn’t see these replies until just now. I put a copy of the app/workflow in Dropbox here: https://www.dropbox.com/sh/9y694q74ktpdm6a/AADuF7I82e-2TApOoJza4z0Na?dl=0 . It is very simple and doesn’t provide any prompts, but it does work and dittos subfolder content. I have only tested it in Sierra.




      • Thank you for the input on merging folders and the app created. I am on Sierra. I still have files missing after 4 months of working with Apple senior advisors. The files went missing after and upgrade to high Sierra. I then had to manually move files from a time machine back up after ordering a new computer and having it restored to Sierra then I was told to restore the back up from before high Sierra was installed then manually bring files over for the months I was creating new files after upgrading to high Sierra. It worked I thought until I found many more missing files and now I have to move forward without them. I do have another Delmia and that is the iPhone back ups on the computer which is all I was using to back up my phone for years. When I restored the data version of my computer before high Sierra was installed I was not able to bring the back up files over that were created during the use of high Sierra do you have any suggestions




  • “Options when Merging Folders” does not work in High Sierra. Even holding the Alt key while dragging the subfolder will NOT give you the Merge button even though there is one additional file in the directory to be merged. – at least not when the source is a TB connected RAID0 and the target is a USB connected 4TB drive on an iMac5K




  • ditto works with smbfs folders as well. Thanks for the tip.