Hazel Rule Examples

I am newer to Hazel than I’d like to admit discovering it only a month ago.

Similar to workflow, I wanted to start a thread where we can post hazel rules we’ve built to document:

  • How we’re using Hazel
  • Actual Hazel Rules that can be downloaded and installed (if they fit you’re use case).

Can’t wait to get started.

Best,

MM

6 Likes

I have a few folders set up with rules:

  • Downloads: Apply blue label to new items, apply red label to old items (older than 4 weeks), open any images with the tag “Optimize” in ImageOptim, remove blue label to new items older than 1 day old.
  • HealthFit: HealthFit is an iOS app that can save your workouts as .fit files. Using various filename matching, I use Hazel to apply tags to the files. The rules are fairly self explanitory: Tag bike rides with routes, tag walking with routes, tag workouts, tag activities from Workoutdoors, Tag Activities from Zones app
  • Desktop: I have a folder called “Screen Shots” on my Desktop. My rules centre on that. The first rule automatically moves any screen shots to that folder. The next two check the number of items in the Screen Shots folder; if there’s any, it gets a yellow label, otherwise any label is removed.
  • Screen Shots: As 99% of the time when I take a screen shot I’m doing something with it right away, I have a rule that removes any files older than 1 day from this folder.

I have a few other small odds and ends, but those are the main ones I use right now.

EDIT: These are all kind of specific to my machine at the moment, but if anyone wants a copy of my rules, I can make it a bit more generic and export it.

5 Likes

I’m using Hazel to sort out a lot of my utility bills and other pdfs I get (thanks David for the pdf dates video!)

Most of my files typically end up in the downloads folder and so I have the vast majority of my Hazel rules acting upon this folder. This way I reduce maintenance effort, updates are done only once, etc

I also have a temp folder in each of my cloud services (Dropbox, GDrive, and my NAS). Hazel checks them and drops the files in there into my Mac’s download folder. And from there apply other relevant rules.

Hazel is one of those little hidden apps that I couldn’t live without. At work I have a windows machine with very limited access to install apps. Every single day I think how much I miss Hazel for a lot of file management tasks!!

2 Likes

I’m using Hazel mainly for sorting pdf’s (invoices, bank statements, receipts, etc.). Scans will be OCR’d (through Abbyy Finereader) and as much as possible moved to the right folder. That saves me a lot of time. Downloaded pdf’s are processed in the same way.
Besides those rules I have one rule to upload a specific downloaded file to my Linux server to be handled there.

1 Like

My workflow on my download folder is to sort files depending on the type and have it available on Yoink app for easy access. Yoink app is always my final destination after having Hazel sort my files or if I did some screenshot.

I let Hazel also throw any files to the trash if I haven’t opened it for 3 months on my Download folder.

I think it takes a bit of time to really use Hazel to its best effect. I never thought about it much, but I realised the other day how much less I use TextExpander because Hazel is creating most of the file names for the documents I archive. Hazel is a multi year journey. Just the other day I the penny dropped and I found a useful way to use the Hazel Sync function.

If you want some examples, here at https://bjarte.me/2014/08/21/automated-file-organization-with-hazel.html there is a couple of simple workflows I saw the other day in my web travels. However not quite sure a bout the merits of locking files - even if you are keen on not deleting in error.

1 Like

I have a rule that automatically opens any document downloaded from my firm’s case management system, using Hazel’s URL matching feature. This gets the system’s behavior close to the system’s behavior on Windows. On Mac, you normally would need to download the document, then go to the downloads folder to open it.

1 Like

Interesting. Could you share how do you hook in to Yoink from the folder structure using Hazel?

World be great to post example Hazel scripts. Have had the app for a year or so and def don’t feel like I am using it to it’s full potential.

2 Likes

I use an app from the MacOS store called PDFScanner. It OCR’s all the things I scan in but it also has a plugin for Automator where it will OCR any image. I have Hazel OCR-ing everything in the downloads folder as that is my dumping grounds and sorting it to the correct folder on Dropbox. The best thing about Hazel is that it can look inside a PDF that has been OCRed and then take action on it.

The other Hazel workflow is that I write a lot for websites and use iA Writer. I have a dumping area where I put all my “working on” stuff and after a week of inactivity on those text files they get sorted into the correct site folder for later reference.

I also take a lot of screen shots and after 1 hour on the desktop they go to a folder for 30 days where they’ll be deleted after 30 days.

1 Like

Can you post a photo of the rule, how do you do it?

That’s the second level stuff I am trying to learn.

Thx in advance!

Have you found OCR to be accurate?

I’ve been finding numbers are great but text can be spotty and not as reliable for Hazel matching.

I find it to be 95% accurate.

Here you. Pretty simple, actually, once you know which trigger to use. Attaches to the Downloads folder.

50%20PM

Going to direct you to the person who created it: https://www.bartbusschots.ie/s/2017/11/24/automatically-adding-screenshots-to-yoink-with-hazel/

Then I used the same script for all the files that I need to work on immediately.

1 Like

one example is that I use Hazel to monitor 2 folders in Dropbox: 1 day and 1 week. (I think I got that one from Katy on one of the MPU episodes)

When I share a file with someone through dropbox I put it in either the 1day or 1week folder, get the link and let Hazel do the cleanup afterwards once the time limit is passed.

2 Likes

Apart from the dropbox one I also use it to clean up omnifocus backups, 1password backups and any other miscellaneous files out there that tend to pop up. It just looks at the dates, and after about 7 days puts them in the trash.

From there I set hazel to clean the trash at a specific size limit, and again, no hassle

I built a photo workflow based on this link, which is very helpful even if that’s not your goal:

Modified in part to include exiftool as discussed here:

https://www.noodlesoft.com/forums/viewtopic.php?t=3331&f=3

2 Likes

And lastly have it set up to monitor an icloud folder I drop all my files in from any device, it looks at the name/date/origin/content and sorts it according to some rules I set up.

one example:

if it is a pdf it looks at the content to see if it contains a + e + i + o (thank MacSparky for that one) If there not present it sends it to my OCR folder (also monitored by Hazel) for processing, and then gets returned and filed in Devonthink and my archive folder on my Synology.

Katie had a Hazel flow to look at PDFs and OCR them. Cannot track this down as she seems to be building new web page. Anyone have this?