Page 1 of 1

Help with Matching

PostPosted: Mon Aug 06, 2012 2:32 am
by vanper
When I download a bank statement from my bank, the file name has the following format:

9digitaccountnumber-ddmmmyyyy.pdf which looks like

123456789-20Jul2012.pdf

What I want to do is rename this file to be

9digitacountnumber yyyy-mm-dd.pdf so it looks like

123456789 2012-07-20.pdf

I have read the using match patterns section of the help menu but I am a little stumped about how I can do this??

ETA: With more fiddling, I have defined custom tokens for the year, month and day and can rearrange them in the renaming so I can get from 20Jul2012 to 2012-Jul-20. But how can I turn 'Jul' into 07 (or whatever month it is)?

ETA (again): OK I think I've worked it out - when I rename, I tell the custom token for the month to replace the text Jul with 07. I have put in 12 such replacements, one for each month.

This 'seems' to be working.

I apologise if this post is a really dumb question. I won't delete it in case it helps someone else but if you think its not that useful, then just delete it.

I have no experience with programming, apple script etc and so working out these rules is a whole new world for me..... :oops:

Re: Help with Matching

PostPosted: Mon Aug 06, 2012 4:05 pm
by Mr_Noodle
Not a dumb question and the solution you came up with is fine. Using the text substitution is necessary because if you use a custom token, there's no way for it to know that it's a month. It just sees it as either text or numbers.

Re: Help with Matching

PostPosted: Sat Aug 11, 2012 10:53 am
by hepabolu
Could you please explain more in detail? I'm trying to do a similar thing and the rule doesn't work. This is what I'm trying to achieve: rename 'invoice_ddmmyyyy.pdf' to 'company-yyyymmdd.pdf'.
I've made a rule Name matches 'invoice_(*day)(*month)(*year).pdf' with
(*day) = <digit><digit>
(*month) = <digit><digit>
(*year) = <digit><digit><digit><digit>

but the match always fails.

EDIT: Got it, don't include the extension in the match pattern.