Hazel Renaming to specific format


I am very new to these Hazel automations and I would like to get it rename my files after its moved into right folder to certain way that I have no idea how to do it. I am scanning old receipts to get rid of papers and I made the automation so it will look up for the first part of the name for the date which I enter there manually to get it right on every paper since some of them may have more than one date in them. So after its moved the file into correct folder I would like it to be renamed in way that the name would be in format yyyy-mm-dd - example “2021-07-02 - Receipt 1” without quotes. I could make this just by doing the file date in that format already in the first place, but since I need to add all the dates by hand I thought it would go a bit faster if I just send a file to Hazel monitored folder in format yyyymmdd and then let it rename it to easier to read format. But its important the name should have all the same information as before but only in new slightly different format.

Sorry for the messy explanation :grimacing:

I’m trying to understand, but I’m not sure I’m with you, so let me try to restate what I think you’re asking.

  • You are scanning papers and manually naming them
  • You would like Hazel to rename them with “yyyy-mm-dd - Receipt 1”


  1. What names are you giving them to start with?

  2. Are you naming them something like “yyyymmdd.pdf” and just want Hazel to add - and “Receipt” and a counter?

  3. Going back to question 1, will all of the ‘final’ filenames be based on a original filenames?

Maybe give an example of 3-4 filenames, showing what the actual literal “original” name would be, and what the actual literal “final” name should be, and perhaps that will make it more clear.

I am naming the original scan as “20210526New bike”. Then I would like hazel to check if there is folder structure in “Receipts” folder for that year and month and if not then make those folders, otherwise just place the file in existing folder structure of that date. After that place the file into correct folder and then rename it to “2021-05-26 - New bike”.

So far I get the files sorted into correct folder structures and named as “2021-05-26 - 20210526New bike”. And as I mentioned before I could name them in the first place as “2021-05-26 - New bike” and then I would not need to do renaming in Hazel, but it is much faster to type everything without dashes in between and then let the Hazel rename it correctly

I am also looking forward to find any more efficient way to do this. But since I have zero knowledge of scripting nor programming of any sort I think this method would be the best I can do for now.

All I want overall is to have folder structure in iDrive where are all my receipts from past x years are easily searchable format. And because I can’t figure out how to do machine reading or any of that stuff I ended up with solution where I manually check the date of that receipt after scanning it with my Iphone and then typing it to its file name with some hint what that receipt is about.

I also thought that it would be a good idea to add tag into these scanned files that states they are “receipts”. But I am not sure is that necessary since all the files in those folders are going to be receipts so sorting them with tags doesn’t do anything.