New to Hazel, is it possible to do what I need?

Talk, speculate, discuss, pontificate. As long as it pertains to Hazel.

Moderators: Mr_Noodle, Moderators

Hi everyone, sorry if this isn't the best place for this! I'm new to hazel and I'm trying to set up a rule to rename episode files. I'd like to change this:
[show name] - 123 - [episode name].ext
to this:
[show name] - S01E23 [episode name].ext
but the number in the filename is not always 123 obviously. I could do this with a few rounds of regex manually in a file renaming tool I have, but that would defeat the purpose of automating.
is this possible with Hazel itself or would I need some sort of secondary script in the action? I'm unfamiliar with apple or shell scripts, and automator is finicky trying to get this to work in my experience, so i'm not sure how i'd proceed.
thank you for your help!
BabyDibbert
 
Posts: 1
Joined: Thu Jul 10, 2025 12:47 am

Look up "match patterns" in the manual.
Mr_Noodle
Site Admin
 
Posts: 11998
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Hope nobody minds me chiming in. :D

If the filename is consistently 3 digit format, it should be easy. It's trickier if you have a show with more than 9 seasons (but doable as long as the episode is always 2 digits). I think the logic you're looking for in the pattern match would be:

CONDITION:
Name Matches: [Show] - [Season][Episode] - [EpisodeName]

In this condition, I would define the tokens (in square brackets) as follows:
[Show] = Custom Text [Anything]
[Season] = Custom Text [number]
[Episode] = Custom Text [digit][digit] (Will only work if episode is always 2 digits (eg: "103" for S1 Ep 3)
[EpisodeName] = Custom Text Anything

ACTION (Rename with pattern):
[Show] - S[Season]E[Episode] [EpisodeName][extension]

Change Number format of both [Season] and [Episode] to "00"

Here's a mockup, I made:

https://drive.google.com/file/d/1KvAqqe ... share_link

Hope it helps
Lachlan Williams
 
Posts: 26
Joined: Fri Jun 11, 2021 4:06 am


Return to Open Discussion