How to join the files into a similar directory tree? I've two similar directory tree in different HD, but inside many groups of subfolders named e.g. B and C (note inside B and C there are others subfolders) there are different files (e.g. file 1,2 in the first and 3,4 in the second) . I would like to join the different files and substitute them if they have the same name. So at the end I would like to have in the folder B: 1 and 3 and in the folder C: 2 and 4. In windows I simply drag inside the old folder A the folder B and C from the second folder A then I click to substitute all but if I do the same thing in OSX I delete file 1 and 2, because OSX substitute folder and not the files inside. How can I solve the problem?



Please note, I have many folders and subfolders inside my A folder so I would like to do it as quick as I do it in Windows.
Finder has supported merging folders since 10.7:



If the target folder has at least one file that is newer than the corresponding file in the source folder, Finder merges the folders by keeping the newer files, and the Merge button is shown as Keep Newer:



The dialog with the Merge or Keep Newer button is shown if you copy a single folder but not if you move a folder or copy multiple folders.

Another option is to use rsync:

rsync -aE ~/dir1/rootdirectory ~/dir2/


Options:


-a: archive (-rlptgoD or --resursive --links --perms --times --group --owner --devices --specials)
-E: preserve extended attributes, resource forks, and ACLs
-nv: show what files would be copied (--dry-run --verbose)
--ignore-existing: don't replace files that are older in the destination
--delete:  delete files from the destination that don't have corresponding files in the source