Mass-produce Hazel Rules

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

Moderator: Mr_Noodle

Mass-produce Hazel Rules Sun Jun 28, 2015 11:17 am • by ccaspell
I have just started to use Hazel more seriously (having bought it a few years ago) and wondered if it was possible to create rules in a spreadsheet-type way and then import them into Hazel. My reason is as follows:

I have a number of clients, each has a client code. Each client folder has 4 sub folders, and within each subfolder is a year folder. The 4 sub-folders are the same across each of the clients, as are the year folders. My file-naming convention is to put the client code at the start and a suffix at the end designating where I want the file to live, so for example "M08 Client records - A2015" would put the file into folder M08->Accounts->2015.

I can set this up client by client fairly easily and can duplicate each rule to speed it up a little, but, with over 150 client codes it would be so much easier if I could create a sheet and simply put the client code and path to the folder needed and copy and replace as necessary.

In any case I believe the time saving from using Hazel in the future would make it worth the time me creating each rule one at a time, however I wanted to check if there was a simpler way to mass-produce the rules before I started.

Thanks in advance for any advice offered.

Chris
ccaspell
 
Posts: 3
Joined: Sun Jun 28, 2015 10:56 am

Re: Mass-produce Hazel Rules Mon Jun 29, 2015 11:55 am • by Mr_Noodle
There's no way to create rules this way. Maybe I'm missing something but do you need separate rule sets for each client? Does the client code need to be hardcoded into the rules? Is it possible to grab the client code from the file name? I guess I'm missing something in your workflow here.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Mass-produce Hazel Rules Mon Jun 29, 2015 12:11 pm • by ccaspell
Thank you for your reply. Perhaps this may be possible to do in another way, but, as I said, I am very much new to Hazel so please if you have any better suggestions I am very open to hear them.

The client code will always be in the file name so yes it should be possible to grab the client code from the file name, but how might this help me.

Using the example I gave before, namely "M08 Client records - A2015" I have emboldened the bits that I would like Hazel to use. The folders all start with the 3 digit client code (so M08 for example) followed by a space, a hyphen, another space and the client name. So the folder might look like "M08 - Billy Morse". Is it possible (or moreover relatively easy) to ask Hazel to look at the first 3 characters of the file name and then find the correct folder (in this case 'M08 - Billy Morse')?

Once in that folder, there will be 4 folders (call them A, B, C and D for now) and within each of these folders we have additional 'year' folders (2012, 2013, 2014, 2015 etc). The above file name (M08 Client records - A2015) will go into client folder M08 and then, within that the 'A' folder and within that the '2015' year.

I would love to create one rule set and apply it to all clients if possible...your knowledge and wisdom on how to do this would be very much appreciated :D
ccaspell
 
Posts: 3
Joined: Sun Jun 28, 2015 10:56 am

Re: Mass-produce Hazel Rules Tue Jun 30, 2015 1:39 pm • by Mr_Noodle
Look up "match patterns" in the help. That should show you how to create custom attributes based on stuff in the filename. You can then use those in a Sort into Subfolders action using whatever structure you want.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Mass-produce Hazel Rules Wed Jul 01, 2015 12:42 pm • by ccaspell
Thanks Mr Noodle for your time but having looked at 'match patterns' I still cannot see how using them will help me without my needing to create a rule for each client folder/sub-folder. Essentially I need Hazel to look at the first 3 characters of the file name and the last X characters at the end (after the dash) and put the file into the corresponding folder in the filing system.

If you have the time (and inclination) to spell it out how I might do what I am trying to do I would be grateful, but otherwise please don't worry about it - I shall spend a couple of days creating the rules client by client and go from there.

Thanks again for your kind assistance.
ccaspell
 
Posts: 3
Joined: Sun Jun 28, 2015 10:56 am

Re: Mass-produce Hazel Rules Thu Jul 02, 2015 2:33 pm • by Mr_Noodle
Use a custom attribute to match the first three characters and another to match everything at the end. Something like:
Code: Select all
    Name matches (•client)(anything) - (•blah)

where •client matches three characters and •blah (not sure how this is used) is set to match everything. You'll have to tweak it from there but that should get you started.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support