Create Hazel Rules Automatically From File Contents

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

Moderator: Mr_Noodle

Hey everyone

I'm wondering if there is a way to automate creating new rules in Hazel?

I manage a number of clients - and I have Hazel set-up to sort documents/images etc for each of them into the relevant folder based on tags and filenames.

So let's say I have a Project Files folder containing these example clients:
    Alpha Corp
    Beta Corp
    Gamma Corp

Each of these has subfolders called Images, Video, Documents

If I download an image for Beta Corp - I will tag it with client code or add it to the filename (something like "beta"). Hazel picks this up and detects its an image and puts it in Beta Corp's Images folder.

So far so good.

However I'm going to be onboarding many new clients soon.

I'd like a way for Hazel to create all the relevant rules for a new client automatically when a folder is added to Project Files.

Let's say I add a folder for Delta Corp - and inside the folder I have a text file (or something along those lines) that specificies "delt" as the client code for Delta Corp. I need this to be detected, and all the rules to be created to watch for "delt" in the tags or filenames of new documents and sort them into the relevant folders in Delta Corp.

I've looked at Automator and searched around a lot - but can't get my head around how to do this!

Any help would be much appreciated
exiatron
 
Posts: 1
Joined: Mon May 23, 2016 9:47 pm

Search the help for "match patterns". You can use those to consolidate your rules down. If the "code" you insert is in the same part of the filename then it should work. If the code is going to be different than the actual name, you can use text replacement to replace those codes with the actual name. While you may end up with a big table of replacements, you'll still have just a small number of actual rules.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support