Merge Same Name Files into Folder Mac OS X
In this article
Yes, macOS has a built-in feature that lets you merge two folders with the same name, and it can also keep both files when they share a name. When you drag one folder onto another with the same name, macOS asks if you want to Merge, and if individual files inside have identical names, it offers to Keep Both. This article explains exactly how that works, what the options mean, and what to do when you need more control.
How the Built-in Merge Works
The merge feature appears when you drag a folder onto another folder that has the same name in the same location. For example, if you have Photos on your Desktop and another Photos folder in Documents, dragging the Desktop one onto the Documents one triggers a dialog. macOS does not overwrite the entire folder; it combines the contents.
- Merge – Combines both folders, adding files that are unique and asking about conflicts.
- Stop – Cancels the entire operation, leaving both folders untouched.
- Replace – Deletes the destination folder and moves the source folder in its place. This option only appears when the folders are not identical in structure.
When a conflict arises because two files have the same name, macOS shows a separate dialog. You can choose Keep Both to save both files, with the incoming one getting a suffix like file 2.txt or file copy.txt. Alternatively, you can select Stop to skip that file, or Replace to overwrite the destination file with the source file.
Where to Find the Merge Option
The merge dialog appears only when you drag and drop a folder onto another folder with the same name in the same parent directory. It does not appear if you use Copy and Paste or if you use the terminal. Here is the exact sequence:
- Open two Finder windows showing the parent folder that contains both same-named folders.
- Drag one folder onto the other. Hold the mouse button until the dialog appears.
- Click Merge in the dialog.
- If file conflicts appear, choose Keep Both, Stop, or Replace for each file.
If you hold the Option key while dragging, Finder copies instead of moves, but the merge dialog still appears. The merge works the same way.
What “Keep Both” Actually Does
When you select Keep Both, macOS keeps the file that was already in the destination folder and adds the incoming file with a modified name. The exact naming pattern depends on the file extension and macOS version. For example, if you have report.pdf in both folders, the incoming one becomes report 2.pdf on older systems or report copy.pdf on newer versions. The original file in the destination folder keeps its name.
This is not a true merge of file contents. It only keeps both files as separate items. If you need to combine the actual data inside two files with the same name, you must do that manually with the appropriate application, such as a text editor or spreadsheet program.
Common Problems and Misconceptions
One frequent issue is that the merge dialog does not appear when you expect it. This usually happens when the folders are not in the same parent directory or when you are using a different method like Command+C and Command+V. Pasting a folder onto a same-named folder always asks to replace, not merge, and it does not offer “Keep Both” for individual files.
Another misconception is that “Replace” in the folder dialog replaces only the conflicting files. It does not. It replaces the entire destination folder with the source folder, which deletes any files in the destination that are not in the source. Always choose Merge unless you are certain you want to lose the destination folder’s unique files.
Some users also expect the merge to work with files that have the same name but different extensions, like data.txt and data.csv. Those are different names, so no conflict arises. The conflict only happens when the full file name, including extension, is identical.
Alternatives for Bulk Merging
If you have many folders or need to merge files with more control, the built-in Finder method can be tedious. Several alternatives exist:
- Terminal commands – Using
dittoorrsynccan merge folders and handle conflicts with more options. For example,rsync -av source/ destination/copies files and can be set to skip or overwrite. - Third-party apps – File managers like ForkLift or Path Finder have more advanced merge tools, but they are paid applications.
- Automator or AppleScript – You can write a script to automate the merge process for a set of folders, but it requires some programming knowledge.
For a one-time merge, the built-in method is usually sufficient. For regular or complex merges, learning the basics of rsync is worth the effort.
Safety and Data Loss Prevention
Merging folders can lead to data loss if you choose the wrong option. Before merging, make a backup of the folders you are combining. You can copy them to an external drive or use Time Machine. The Replace option is the most dangerous because it deletes the destination folder entirely. Even the Keep Both option changes file names, which can break references to those files in other applications.
If you are merging folders that contain important data, test the process on a copy first. Create two test folders with dummy files and practice the merge to see exactly what happens. This is especially important if you are using Terminal commands, where there is no undo.
Frequently Asked Questions
Can I merge folders with the same name in macOS Sonoma or Sequoia? Yes, the merge feature has been in macOS for many versions, including the latest ones. The dialog wording may vary slightly, but the functionality remains the same.
Why doesn’t “Keep Both” appear for my files? “Keep Both” only appears when there is a file name conflict during a merge. If you are using Copy and Paste, you only get “Replace” or “Skip”. Use drag and drop to trigger the merge dialog.
Does “Keep Both” work for folders inside the merged folder? Yes, if a subfolder has the same name as another subfolder, macOS will ask to merge those subfolders as well, and you can choose “Keep Both” for files inside them.
What is the difference between “Merge” and “Replace” in the folder dialog? “Merge” combines the contents of both folders, keeping unique files and asking about conflicts. “Replace” deletes the destination folder and moves the source folder in its place, losing any files that were only in the destination.
Can I undo a merge? No, there is no built-in undo for Finder file operations. If you accidentally replace a folder, you can only recover from a backup. That is why backing up before merging is essential.
Does merging work with iCloud Drive folders? Yes, the merge works with folders stored in iCloud Drive, but the files may be downloaded first if they are not local. The process is the same, but it can be slower.