How to merge (and not replace) folders when copying on the Mac?

94,256

Solution 1

Try MacUpdate, Softpedia and Brothersoft. Search for Folder Merge.

Folder Merge

Small software utility that will merge folder contents

By Default OSX doesn't merge folder contents so this is a simple GUI tool to do just that.

If simply you want to merge the files located in two separate folders, you can easily do that with Folder Merge.


Unison

This is free.

Unison is a file-synchronization tool for Unix and Windows. It allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), modified separately, and then brought up to date by propagating the changes in each replica to the other.

Solution 2

Once in Terminal, type: ditto from_folder destination_folder

Ex:

ditto ~/Desktop/SomeFolder ~/Desktop/SomeOtherFolder

Infallible.

Solution 3

Holding down the Option key on Mac OS X Lion gives you the option to 'Keep Both' which then merges the two folders.

This was one of the new features of Mac OS X 10.7 Lion.

Solution 4

I'm a proponent for full-blown support for merge-replace-skip in the Finder, no question. In fact, it's disheartening that Apple's simplicity-minded philosophy actually results in more mouse movement, more clicks, and more steps to accomplish what seem like simple things. And clearly people want to see this kind of change (among many others) in the Finder, especially. Snow Leopard has made some steps towards FTFF with the Cocoa-rewrite.

Thanks to this Cocoa-rewrite, bliss has arrived in the ability to extend/hack the Finder in Snow Leopard with plug-ins thanks to SIMBL, which provides means for hacking/reverse-engineering Cocoa-based apps. So I figure it's only a matter of time until someone extends Finder to support this more natively. Regardless, Apple is still to blame for the Finder flaws, and they need to own up soon and just Fix the Freakin' Finder, once and for all! (I mean, it is so central to the OS you'd think they'd have done this by now.) < /rant >

Meanwhile, you can fool Transmit into using its merge capabilities with your local files: http://andrew.hedges.name/blog/2007/01/16/merge-folders-with-transmit

Solution 5

I'm the author of TotalFinder SIMBL.

Replace instead of "copy over" is a big issue in Finder I think. I know two people personally who lost data because of this "feature".

On the other side I understand why it is designed this way. I guess the reason is moving application bundles. Application bundle is nothing but folder, when you drag app update to Applications folder you want to replace old app bundle completely without leaving old files in (imagine some app's author is checking existence of some files in Resources subfolder of his bundle).

Ok, so Finder removes a previous folder. But the wrong behavior is that it does not place it into Trash. It deletes it permanently which is really sad and unexpected.


As of TotalFinder modifying this behavior. It is not easy to tweak this process from SIMBL. I'm thinking about replacing whole copy/move functionality of Finder with my own. This would enable me to do several requested features at once:

  1. cut&paste
  2. better copy progress dialogs (like in PathFinder)
  3. implement copy over semantics

The problem here is that it is a lot of work with uncertain results.


In the meantime you have to use Terminal.app with cp -r source/folder destination/folder

Share:
94,256

Related videos on Youtube

cregox
Author by

cregox

sen+cregox@ ahoxus.org (apparently mailto: doesn't work here) legacy "about me" wonder if we got email notifications on this network partially thanks to my ranting. used to think flair rocks (like stackoveflow) but i was blind. :( be sure to visit my current and only project since circa january 2019: AHOXUS previous display name: Cawas (up to 2015 dec 21) profile kind of superficially updated on 2021 feb 11, before i started deleting everything almost 1 year before.

Updated on September 17, 2022

Comments

  • cregox
    cregox over 1 year

    There's a similar question about windows. This is the same, but for mac. By the way, it's odd there's no question on this yet, since it seems like it's the most hated thing on Mac OS X.

    If I try to copy or move a folder to somewhere it already exists, it asks to replace it. That would result in deleting the target. Rather I want to merge.

    There's already a aquataskforce request about this, and it's a discussion going for a long time if it's even something that should exist on Mac, due to its whole philosophy. Discussions at Apple are outdated and didn't help much as well.

    As usual, there are professional solutions for doing this, such as Changes and Araxis. And there is the rsync or command line alternatives. But I want a free and simple solution, something like how it is done in Windows or Linux. I won't be doing it much anyway. By the way, PathFinder don't have such option as well and FolderMerge doesn't work on Snow Leopard as far as my 1 test went.

    Suggestions to whom may come up with a solution:

    I think a good idea would be to move everything non-exact-duplicate to the same folder, and leave every duplicate behind. No confirmation is needed in this case, and I can easily check the duplicates later. If it's copying merge, then the target folder will contain everything, and the source will be rather untouched. Duplicate-check is just on the file name. Leave any more complicated thing to third parties.

  • Josh K
    Josh K about 14 years
    Transmit rocks.
  • cregox
    cregox about 14 years
    That's something I might try later on, if nothing better pops up. :P
  • user3055603
    user3055603 about 14 years
    It was bugging me to no end, so I searched and searched until I found that reference to Snow Leopard extensibility I mentioned above. And while Apple did pave the way for Finder plugins/extensions by rewriting the Finder in Cocoa, the pluggable nature actually comes not from Apple directly, but from a little gem called SIMBL (Simple Bundle Loader, en.wikipedia.org/wiki/SIMBL)
  • user3055603
    user3055603 about 14 years
    Long story short, it enables hacks and plugins for Cocoa based apps. AKA Cocoa hacking! ... More details about this "application enhancement loader" can be found here: culater.net/software/SIMBL/SIMBL.php ... There are already a number of plug-ins (and growing): code.google.com/p/simbl/wiki/SIMBLPlugins (and of course, any Finder extensions require Snow Leopard).
  • user3055603
    user3055603 about 14 years
    Here's the development wiki for anyone interested in diving in and making a Finder bundle for merging files and folders: culater.net/wiki/moin.cgi/CocoaReverseEngineering ... As I said, once people get a hold of this info, it's only a matter of time before someone develops this functionality. I just wish I had to time to do it myself! :)
  • user3055603
    user3055603 about 14 years
    By the way, the plugin I had original come across that lead me to SIMBL was called TotalFinder and it fixes a lot of really nagging annoyances in the Finder (FTFF FTW!). Among other things, it adds options to the Finder for supporting: a global keyboard shortcut (hotkey), tabbed file browsing, dual panel and folders on top! Check it out: totalfinder.binaryage.com ... (Maybe we could get these guys to add merge support themselves?)
  • cregox
    cregox about 14 years
    @purefusion That's pretty cool stuff. I just hope those hacks and plugins won't bloat finder up too much! On a side note, I'd say you could have edited your answer once again rather than writing all those comments. It's generally a better practice here in SO. ;)
  • Bryan
    Bryan about 14 years
    Add me as a third person who lost data due to this. The data wasn't important fortunately, but it was annoying non the less. - Of course had I have read the message properly, it wouldn't have happened. But I was in disbelief when finder didn't even put the deleted directory into trash. FTFF Apple!
  • user3055603
    user3055603 about 14 years
    Excellent work on TotalFinder, I must say! I'm thankful for Apple's Cocoa-ifying the Finder so you could make your masterpiece. I occassionally get flamed for being "resistant to change" but I grew up on a Mac, not a PC. Apple is the one refusing to change, and I quote Steve, "because we like the behavior of the Finder"
  • user3055603
    user3055603 about 14 years
    The least they could do is make it more customizable (and hey, MS is at fault here too, just not on the same level). Having spent time to provide a solution to the issue yourself, even if via hacks, makes Macs more tolerable, so I respect you very much for doing that. Meanwhile, investing more time in a merge solution is a tricky venture, because at that point, you're dealing with users' data, which is something you want to approach very cautiously and with a lot of testing. I'd hate to have been one of the unlucky subjects of the recent Snow Leopard data loss bug.
  • cregox
    cregox about 14 years
    In this end, your "meantime" solution still is the best. At least from my point of view.
  • cregox
    cregox over 13 years
    Just as an addition, SyncTwoFolders looks pretty good: superuser.com/questions/206041/mac-software-to-merge-folders‌​/…
  • stib
    stib over 13 years
    shouldn't it be cp -Rn source/folder dest/folder? The -n switch means don't overwrite any existing files. And according to cp's man page there is no -r option (though weirdly enough it still works).
  • user3055603
    user3055603 over 10 years
    Shouldn't have to hold down option to get the prompt, but it's still better than the other solutions, given that it's built-in. Thanks for adding this here!
  • Michael Innes
    Michael Innes almost 10 years
    Unfortunately, holding down the Option key will Copy instead of Move the files.
  • JVC
    JVC almost 10 years
    Is it my imagination or is this option no longer available in Mavericks??
  • tyron
    tyron almost 10 years
    @JonathanvanClute seems the "Merge" option is available when you copy the folder. So far, I guess the best solution is to copy/merge folders, and then delete the original (doesn't seem like an Apple solution, but still works..)
  • JVC
    JVC almost 10 years
    It's not available for me on copy either... how are you getting it to appear?
  • HikeMike
    HikeMike almost 10 years
    @JonathanvanClute: Are you pressing Option while the dialog is shown?
  • JVC
    JVC almost 10 years
    Yes... nothing happens like it used to pre-mavericks. No change in the button states, nothing.
  • HikeMike
    HikeMike almost 10 years
    @JonathanvanClute: When copying, I get a dialog with three options, one of then Keep Newer, which is probably more descriptive than Keep Both.
  • JVC
    JVC almost 10 years
    Nope... nothing of the sort. All I get is Don't Replace, Stop, and Replace. Option key does nothing.
  • HikeMike
    HikeMike almost 10 years
    @JonathanvanClute Are you copying only one element?
  • JVC
    JVC almost 10 years
    I'm copying a folder fill of files.
  • Roberto
    Roberto about 8 years
    Looks like "Merge" in El Capitan will pick the newest file instead of the file from the "from" folder... am I right?
  • publicJorn
    publicJorn over 6 years
    Note that ditto overrides a file at at destination if it has the same name. Even if the destination file is newer.