Page 1 of 1

Rename File with Incremented Numbering

PostPosted: 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.

Re: Rename File with Incremented Numbering

PostPosted: 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.

Re: Rename File with Incremented Numbering

PostPosted: 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?