2

I'm among those unlucky few (I'm hoping there are more than one) that are stuck with truly utterly messy backups from multiple machines, in multiple folders.

I've now managed to figure out that I've got one folder with 18gb and 44000+ files and one folder with 17gb and 34000+ files. They are the same folder, but one is on backup2/ and the other is in backup3/. I've used MacPaw's Gemini to remove duplicates from folder1 - and sometimes used Gemini to remove duplicates from folder2. They could be described as being totally out of sync with eachother - they are from separate times and now with mismatching files - i.e., there are duplicates there, but not really enough to use Gemini easily.

I'd like to compare and merge them, but safely. Without losing folders. One might have a subfolder inside a subfolder with 35 files, the other with 12 files - yet the 12 files wouldn't be in the 35 files, so I'd have to be able to merge subfolders so that I don't lose any files. Also, there are, as you would expect, duplicates there too, files with the same name, but with differing file content. I'd have to make copies of those to compare them, remove lines (in case of a textfile) from txt1 and add them to txt2, etc.

What should I do, and which app should I use to visually be able to combine these folders and their subfolders and their contents, merging the files and only keeping the ones that are absolutely differently sized (maybe I've touched a few of the files, maybe not, it's a total shambles).

How should I proceed? I'm running diff on the folders, but that's really quite complicated work.

I realize this is quite the complex question.

  • If there 2 files with the same name do you want both or just one? – user151019 Jul 2 '15 at 16:14
  • @Mark Ideally I'd like to take the subfolders and files and combine them into one singular folder instead of two folders with multiple subfolders. I've been using something called DeltaWalker to identify which folders are the same and deleting them, and also moving all files from one to the other - but it's still not really how it could be done - I mean, for it to feel safe. – esaruoho Jul 2 '15 at 17:58
  • Sorry you have not answered my question what if you have files A/X and B/X what should be the result – user151019 Jul 2 '15 at 18:02
  • @Mark if they are identical, then only one should be kept. If they're not the same file, then both should be kept, but in the same folder. I'm looking to get rid of one duplicate folder and try and maintain only one of each file. Sorry about not understanding your question originally. Did this help? – esaruoho Jul 2 '15 at 18:16
  • How do you keep both in the same folder of they have the same name? – user151019 Jul 2 '15 at 18:42
4

The rsync command line tool is able to merge two folders. You'll need to open a terminal window. Take a look at the manual pages

man rsync 

There may be a one liner but the following steps are non-destructive since you won't change your source folders.

  1. Create a new folder (dest)
  2. Sync source1_path to dest
  3. Sync source2_path to dest

Here the script - check the manual pages for additional options

rsync -rv source1_path/ dest
rsync -rv source2_path/ dest

The following commands also create copies for non-identical files which exist in both source directories (with a difference in size or timestamp for example)

rsync -rv --backup --suffix=_source1 source1_path/ dest
rsync -rv --backup --suffix=_source2 source2_path/ dest
  • This does not deal with the case where the OP has the same name file in both - but they are different files (see comments) – user151019 Jul 2 '15 at 19:33
  • @Mark Ok, that's new. This scenario can also be covered by adding options --backup and --suffix=_source1 (or --suffix=_source2 for the second source folder). Files with same names but different content/timestamp in both source folders will be both be copied to the target folder. Will add to answer if that is accepted – smile2day Jul 3 '15 at 10:51
  • Not really new - the original question did not have enough information to answer it - you were lucky that your answer works – user151019 Jul 3 '15 at 13:16
  • You are right @Mark this was an aspect not mentioned in the initial question – smile2day Jul 3 '15 at 15:03
  • @Mark I've edited the question so that it should be more informative and useful. Sorry, I was simply too "in" the question to flesh it out properly. – esaruoho Jul 9 '15 at 7:39
-1

Why not view in LIST the folder in which these two folders are ?? Then in View Options sort against CREATE DATE, you will be able to trash the older one and have the newer one survive.

  • 1
    Do you call that merging? – idmean Jul 6 '15 at 20:26
-1

Personally, I prefer to use a simple GUI than raving with command line tools... We don't have to reinvent the wheel :-)

I suggest you Synkron: it works well and it has got a nice, simple interface (oh, and it's open source).

  • While I appreciate finding out about this app, it seems more about multiplying the duplicates in order to keep two separate folders synced.. rather than deleting duplicates in order to maintain one singular folder "of stuff". – esaruoho Aug 6 '15 at 5:33
  • There's some options about duplicates... have a closer look :-) – sekmo Aug 7 '15 at 7:26

You must log in to answer this question.

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