Page 1 of 1

Merge two folders with same subfolder structure

PostPosted: Sat Aug 16, 2014 10:55 pm
by noodlepie
If you have 2 different folders containing subfolders of identical name (see example below) - is it possible to use Hazel to merge the top folders and all subfolders without accidentally overwriting any files? I have two top folders with hundreds of subfiles and dozens of folders. But instead of merging each subfolder manually, Id like to write a few rules that will merge all of the subfolders. For instance (merge subfolder FINANCES and all contents in Records1 with FINANCES in Records2) ...and in case there are any duplicates, Id rather have them renamed than overwritten.

ie...

Records1
- Finances
- Auto
- Insurance
- (20 other subfolders)

Records2
- Finances
- Auto
- Insurance
- (20 other subfolders)

Re: Merge two folders with same subfolder structure

PostPosted: Mon Aug 18, 2014 12:17 pm
by Mr_Noodle
First off, read the sticky article at the top of this forum about going into subfolders.

Next, create a rule to do the copy. For the copy there is an option to copy over the folder structure as well. Set that to copy over the structure from the monitored folder. I think that should do what you want.

Re: Merge two folders with same subfolder structure

PostPosted: Wed Aug 27, 2014 12:43 am
by noodlepie
im having some trouble implement this.

What is the appropriate structure for the following action:

If a folder is tagged RECORDS2, move all of its contents to RECORDS, keeping the folder structure, without overwriting any of the folder contents.

The trouble Im running into is

Source folder called RECORDS2 > HEALTH containing 5 files
Destination folder called RECORDS > HEALTH containing 10 files
hazel sees that the folders have different contents so it creates a new folder is created called RECORDS > HEALTH1.

The desired result is that RECORDS > HEALTH would not rename the subfolder if it has different contents, but the folders would be merged. If there are duplicate files within a subfolder, the files themselves would be renamed, but the subfolders of the same name would merge.

Re: Merge two folders with same subfolder structure

PostPosted: Wed Aug 27, 2014 11:55 am
by Mr_Noodle
Can't say without seeing the rule but I suspect you are matching the folder and copying it instead of the files within. You want to match the individual files. In the move/copy options, you then specify that you want to carry over the folder structure and that you want the files renamed if they already exist.