Page 1 of 1

Change date match (month) digit from one to two digits

PostPosted: Fri Mar 04, 2016 6:59 am
by Tätä
Hello,

I like to know, if it's possible to change a date match from one digit to two digits for the renaming of files?

Example: I have files with the dates in the content like 28.2.2016. I can match the content with date token. For the month I use a one digit token. Now I like to use the matched month and the year to rename the file to: "2016-02_bla-bla-bla.pdf". In the moment, the renamed file is "2016-2_bla-bla-bla.pdf", that means the month in the file name comes from the one digit ("2") match, but I like to change this token to "02" (If I use the two digit date token for the month, then the match - as expected - doesn't work).

Re: Change date match (month) digit from one to two digits

PostPosted: Fri Mar 04, 2016 11:53 am
by Mr_Noodle
You can use different month tokens between the match pattern and rename pattern. In the match pattern, you can use the normal month token to catch both single and double-digit months. In the rename action. In the rename pattern, you can specify two digits months. They are totally independent from one another.

Re: Change date match (month) digit from one to two digits

PostPosted: Sat Mar 05, 2016 5:42 am
by Tätä
Thank you very much!

It's working fine.
Yesterday - before I asked my question in the forum - I have tried with the same approach, but without success, so I asked my question. I suggest that a restart would have solved the problem. I think that hazel needs a refresh when one insert a lot of rules or change a lot of rules, could this be?

Re: Change date match (month) digit from one to two digits

PostPosted: Mon Mar 07, 2016 11:48 am
by Mr_Noodle
It shouldn't but maybe things were in an odd state at the time.