How to Search and Replace the Synch action in 100s of rules?

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

I have hundreds, or maybe over 1000 rules which synch files to somewhere in my Onedrive depending on content.

The final part of the rule has a pattern along the following lines:


Move to folder: Boxcryptor/OneDrive/Documents One Drive/Art1
Move to folder: Boxcryptor/OneDrive/Documents One Drive/Paintings
move to Folder:Boxcryptor/OneDrive/Scanner

Due to Boxcryptor going out of business I need to change the path name in the nearly 1000 rules. To speed this up I would like to use a "Search and Replace" in ordder to change the word "Boxcryptor" to a new volume name.

Based on a 2017 similar question I found, it looks like this has to be done individually, rule be rule, but I am asking again as we are five years later and maybe by now there is a solution?
Trickyt57
 
Posts: 55
Joined: Tue Sep 18, 2018 12:17 am

Try Folder->Replace Folder…
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

I had to update Hazel to version 5.2.2 from 5.1.1 to find the "Replace Folder" command.

Is this the same as the command in the Hazel guide located here: https://www.noodlesoft.com/manual/hazel/attributes-actions/action-reference/relocating-folders/ ? It seemed like a different command as it uses the word "relocate" instead of "replace".

This bulk replace folder is going to save me days of work! Thank you so much.

Testing phase


I want to be sure that this will work in the way intended so I have been experimenting with throw-away folders and files. It seems like a very delicate thing to fiddle with. But after a few hours of testing I can see it is likely to work.

Initially I thought it only did half the job in my situation..... until I found a work-around

This is what works
If I have a file destination /myfiles/boxcryptor/onedrive/scans, I can change every rule using that final destination "scans" to a new destination: /myfiles/cryptomator/onedrive/scans.

In order for this to work I must have at least one rule which moves, copies, or synchs a file to /myfiles/boxcryptor/onedrive/scans

That's great so far, as I have hundred's of rules referencing that folder called "scans". So that's half the job done.

This what seemed to be the problem

However I also have hundreds of rules referencing unique folders, e.g.
/myfiles/boxcryptor/onedrive/bank statements
/myfiles/boxcryptor/onedrive/doctor bills
/myfiles/boxcryptor/onedrive/shopping invoices
/myfiles/boxcryptor/onedrive/investments
/myfiles/boxcryptor/onedrive/utilities bills

It would take forever to change each one of these unique destinations using the aboive method.

In every case I needed to replace the "boxcryptor" destination by the "cryptomator" destination. However under the "Replace" command there was no folder for "boxcryptor" showing on the left hand side.

The work-around
I resolved it by creating a new rule which moved a file to "Boxcryptor". Then when I click on Hazel menu bar, Folder, Replace Folder, it shows "Boxcryptor" in the list of existing destinations on the left hand side, and I then instruct it to replace it with "cryptomator".

The path remains intact with merely the word "boxcryptor" replaced by "cryptomator" in every file path in every rule.


What remains to be done

For the rule to work properly, I'll need to re-create the entire folder structure underneath "cryptomator" in exactly the same way as it was under "Boxcryptor". That's literally hundreds and hundreds of sub-folders. I think there is a function in Hazel to do that, but I have not investigated it yet.

I'll let you know when the job is done successfully.

By the way, thanks very much for the prompt reply. I appreciate that after all these years you still monitor and respond in the forums!
Trickyt57
 
Posts: 55
Joined: Tue Sep 18, 2018 12:17 am

Re-create in Finder or in Hazel? Note that the Replace folder function in Hazel has an option to apply the changes to subfolders referenced in your rules.
Mr_Noodle
Site Admin
 
Posts: 11193
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:Re-create in Finder or in Hazel? Note that the Replace folder function in Hazel has an option to apply the changes to subfolders referenced in your rules.

Thanks! It works. This has saved me many hours, if not days of work.
Trickyt57
 
Posts: 55
Joined: Tue Sep 18, 2018 12:17 am


Return to Support