Although I’ve been using Macs since late 1984, I still find features in the operating system that surprise me. Recently I discovered that there is a merge function in macOS that makes it simple to merge the content of two folders. See how this tip works to make your file and folder organization a lot easier.
The old way
Here I have two folders that I want to merge. As you can see, some of the files inside both folders are the same, some are different, and some have the same name but different times associated with them. If I wanted to spend some time going through each folder and checking out the file names and times, I could create a temporary folder and do this manually.
That would mean just dragging one copy of the identical files to the temporary folder, getting the newer of the text files and dragging them to the temp folder, and then dragging the unique files in the folders to the temp space. This probably isn’t a bad idea with a couple of folders with few files. But what if you have hundreds of files in each folder?
If I wanted to copy all of the files from Folder 2 into Folder 1, I’d select the Folder 2 files, then drag them over to Folder 1 and drop them. Immediately I’d see a dialog telling me that one of the files already exists in Folder 1…
At this point, I could click on the Skip button, in which case the duplicate file wouldn’t be copied. Immediately, the same dialog would appear for “Keynote-Photo-Collage-2.jpg,” and I’d need to click Skip again. Alternatively, I could check the Apply to All box, which would skip copying any files with identical names. That would also skip copying the Test1 and Test 2 text files, which are not identical, as they have different time stamps.
Clicking Stop interrupts the entire file copy process, which isn’t what I want to do. Replace replaces files with identical file names in Folder 1 with files from Folder 2. This isn’t going to help matters. Because one of the files in Folder 2 is older than the one in Folder 1, we wouldn’t want that file to replace it.
So you see the dilemma. It appears that we either need to manually merge the folders, or click a lot of dialog buttons. But there is another solution!
Here’s the trick that I didn’t know about until a few weeks ago. There is a special way to merge folders that doesn’t copy identical files, and always keeps the newer version of files with the same file name. The trick? Both folders need to have the same name.
Of course, if I’m in Finder and I try to name a folder the same as another one, a dialog tells me that that folder name is already taken:
The trick? The Option key
The workaround is this: Create a temporary folder and drag Folder 1 into it. Now give Folder 2 the new name Folder 1. To merge the folders, hold down the Option key before dragging Folder 2 (now called Folder 1) to the temporary folder. A dialog we haven’t seen before appears:
See the Merge button? If we click it, then the contents of both folders are merged into one “Folder 1.” If there are individual files that are newer than their counterparts in the other folder, they are copied or stay in the combined folder.
Looking in the temporary folder (which kept the original name of “untitled folder”), we now see the merged Folder 1:
You can see that we have only one copy of each file from both folders in the merged folder, and the two test text files are the newest version from either folder.
How to avoid making a temporary folder
There is a way to avoid making a temporary folder to merge a couple of folders with the same name. You simply put one of them on another Mac volume. This can be an external drive, a flash drive, or a server.
After making sure that the folders have the same name on both Mac volumes, hold down the Option key, and drag the one folder onto the other volume. As long as macOS Finder sees two folders with the same name and they’re both going to be in the same volume, you’ll see the Merge button.
The Rocket Yard is filled with thousands of articles to answer your questions or stimulate creativity. You may find these articles to be helpful: