MacOS – Merge folders and subfolders in macOS

findermacosmerge

I have 2 folders that I need to merge.

Inside each folder are subfolders. In about 50% of the cases these subfolders exist in both parent folders.

E.g.

 FOLDER 1 | FOLDER 2
  --------------------- 
    SUB 1 | SUB 1 

    SUB 2 | SUB 2 

    SUB 3 | SUB 3 

Although the subfolders have the same names, they do not include the same data and I would like these to be merged. It's not a case of one overwriting the other they actually need to be merged as each contains unique data.

Is that possible in Mac OS X 10.10? I also have access to the same folder via Dropbox on other machines running Mac OS X 10.11 and macOS 10.13.

Best Answer

Open a Terminal, and use ditto:

ditto [source] [destination]

For example:

$ cd ~
$ mkdir A/
$ mkdir A/1
$ mkdir A/2
$ mkdir A/3
$ touch A/1/1.txt
$ touch A/2/2.txt
$ mkdir B
$ mkdir B/1
$ mkdir B/3
$ touch B/1/x.txt
$ touch B/3/z.txt
$ ditto A B
$ open .