I have 2 subfolders (which in itself contains many subfolders) in my main folder.
e.g.
main folder
== subfolder1
==== folder1
==== folder2
== subfolder2
==== folder1
==== folder3
==== folder4
some things in subfolder2 are already in subfolder1. If I drag and drop subfolder2 into subfolder1, it will ask me to replace existing subfolders thus losing things. The only way to merge the folders that I know of is to press the option key. But this only makes a copy. This still requires me to delete the unneeded folder.
I want to move subfolder2 into subfolder1 and merge their contents. How can I do it? Thanks much 🙂
Best Answer
1 Quick answer
Enter this command in Terminal:
cp -r -n ./srcFolder/ ./targetFolder/
Remove the
-n
if you want to overwrite duplicates.Update:
ditto source target
will also do the trick.Files in source folder overwrite any duplicates in target folder.
Add -v for details (
ditto -v source target
)via How to Merge Folders on Mac OS X Without Losing All Your Files (Seriously)
2 Use Finder (surprisingly more complex)
Possibly a duplicate of Where did folder "merge" or "keep both" go in OS X 10.9 Mavericks?, but I'll sum up:
The weird thing is, the folders can't have any duplicate files if you want to merge.
If you're merging two folders that don't have any duplicate files between them, you will see the merge option if you hold the option key.
However, if the folders you're merging contain any files with the same name, the merge option won't show up.
In that case, you basically have two options: