Rename File with Incremented Numbering

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

Moderator: Mr_Noodle

Rename File with Incremented Numbering Fri Jan 30, 2026 3:44 am • by Japandrewz
I want to create a rule in Hazel 6 that does the following:

If a file name contains “XYZ”, rename the file to XYZ and append a number that increments each time the rule runs. For example, this month, the renamed file would be XYZ 232 and the following month it would be XYZ 233.

I would also like to remove the file type extension.

My rule so far is as follows:

Condition: Name contains XYZ
Action: Rename with pattern

I am not able to find Conditional Attributes to allow for the numbering.
Japandrewz
 
Posts: 2
Joined: Fri Jan 30, 2026 3:40 am

Re: Rename File with Incremented Numbering Fri Jan 30, 2026 9:48 am • by Mr_Noodle
In the Rename pattern, there's a # attribute you can drag in. That implements an incrementing counter.

If you want to omit the file extension (which may be a bad idea), just don't include that attribute in the Rename pattern.
Mr_Noodle
Site Admin
 
Posts: 12132
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Rename File with Incremented Numbering Sat Jan 31, 2026 12:15 am • by Japandrewz
Thank you for the reply. I would like to start the incremented numbering with a value that is not 1. How do I set an initial value under the # attribute?
Japandrewz
 
Posts: 2
Joined: Fri Jan 30, 2026 3:40 am


Return to Support