3

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?

enter image description here

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.

3
  • See non Finder answers to apple.stackexchange.com/questions/49263/…
    – mmmmmm
    Oct 16, 2013 at 18:14
  • @Mark In my case I have sub-folders I can't use Merge like the answer below or the accepted in the question you mentioned
    – G M
    Oct 18, 2013 at 13:43
  • See the other NON finder answers e.g. rsync, third party and perhaps even the manual select
    – mmmmmm
    Oct 18, 2013 at 13:48

2 Answers 2

3

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
3
  • you are right it doesn't work with sub folder so I can't use the first method....
    – G M
    Oct 17, 2013 at 15:55
  • @GM You'll want to use rsync or a graphical file manager such as Transmit if you need subfolders to get merged (or mount the drives on Windows using SMB file sharing from the Mac)
    – bmike
    Oct 18, 2013 at 15:18
  • Thanks a lot for the help! I'm trying with rsync but I've some problem...I will try with Transimit
    – G M
    Oct 18, 2013 at 15:20
0

FileMerge (part of Developer Tools) can merge directories as well as files.

Just drag two directories on the Left and Right options and it will create a list of files indicating which are identical and which are part of Right or Left.

You can then choose how to merge the differences (and even specify a different merge path if you wish)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .