For client artwork, I save a lot of versions of files. Enough so that I got tired of manually incrementing the file names when saving JPEGs from Photoshop and decided to see if Hazel could automate this for me. It wasn’t apparent how to do this at first, but the Hazel developer steered me in the right direction. Here’s how to do it.
First, set up a rule as follows:
The key attribute here is the “#” token. You can click on it to set the number pattern for as many digits as you like. I prefer two digits for visually tidy file names in the Finder.
In my case, my files are all saved as “filename-sketch.jpg” when I Save For Web from Photoshop. This saves a .jpg file in the project folder as “filename-sketch.jpg”, which matches the Hazel rule, and it transforms the filename into “filename-sketch-v01.jpg”, and then increments the numbers for each successive .jpg saved to that folder matching the filename pattern in the Hazel rule.
One minor limitation is that Hazel seems to keep its own system to do this, meaning if you delete a file that it has renamed and save a new file that matches the pattern, it will increment based on the last time the rule ran. In other words, if you delete the file Hazel renames as “filename-sketch-v02.jpg”, the next file will be renamed “filename-sketch-v03.jpg”. I can’t really see any way for Hazel to avoid this.