OK thanks. The main issue you have is that you are appending the incrementing number to the end of the filename in your rule. So Hazel is taking the full filename, then adding an incrementing number after it. So your results are as expected, with your rule setup.
You want something more like this:
The number at the end of the filename has been tokenized in my example. Here is the detail on the token:
What I did:
- add the “Custom Text” item to the pattern criteria to match (this is right after "weekly text " in the example screenshot)
- click on the Custom Text token, to edit it
- I named it “number” in the example
- for the attribute, I clicked on Number ([123] attribute) to add it to the token
This tells Hazel, “match a number, and then save it as a custom token to manipulate later in the rule actions”.
In the Rename action, I set it up like so:
What I did:
- click in the text field after “with pattern”
- typed in the text “weekly plan” (you could also tokenize this from the original filename)
- clicked on the Custom Text token we set up above (named “• number” here)
Next, click on the •number token already added to the rule, so we can manipulate the content
Choose “adjust number…”
And then you can add/subtract:
The obscure aspect is to make that custom token, then set the attribute to a Number. That way, in the rule action, we can call it back, and since we told Hazel it was a number, we have those options to manipulate it.
If you wanted to make this rule more universal, you could also tokenize the “weekly plan” text, similar to how we tokenized the ending number, and just tell Hazel to match characters or words.
Then you could pull that token into the renaming action below. Doing this would make this rule more universal, as it would just try to match patterns like “filename XX”, and they could all be incremented regardless of the filename text. In my example, this rule will be “hard coded” to only match files with the text “weekly plan” following by a number.
But I’d get the number incrementation in place first, then experiment further.