Page 1 of 1

Parsing a date out of a filename -- help!

PostPosted: Sun Jan 03, 2021 5:36 pm
by gold7181
OK, I feel stupid as I must be overlooking something simple.
I have a folder with files having names in the format:
Apple Card Statement - May 2020.pdf
Apple Card Transactions - May 2020.csv
...<more files and months>
.
I want to rename them into format: mm-yyy Apple Card Statement.pdf
-or-
mm-yyyy Apple Card Transactions.csv

For some reason (brain fart?) I can't seem to parse the filename into the "<name> <month> <year> <filetype>" tolkens I need to create the new filename. Don't seem to be able to break the original file name apart.

Help? Hazel V5.0.3

Re: Parsing a date out of a filename -- help!

PostPosted: Mon Jan 04, 2021 12:29 pm
by Mr_Noodle
Have you tried using the preview function? Can you post the exact pattern you are using?

Re: Parsing a date out of a filename -- help!

PostPosted: Mon Jan 04, 2021 12:54 pm
by gold7181
Yes, the preview function says "Not Matched" for the entire filename character string, looks like it's not breaking it up according to the pattern:

For example, the filename is "Apple Card Statement - April 2020" and the pattern is:

Apple Card Statement - ºSMonthˇ ºSYearˇ.pdf

where SMonth & SYear are patterns to capture the month & year values.

This would be much easier to show if I could attach screenshots showing the pattern elements but I can't figure out how to do that in this forum software! ?

Re: Parsing a date out of a filename -- help!

PostPosted: Tue Jan 05, 2021 10:55 am
by Mr_Noodle
Uploading screenshots here is not allowed. Try a third party file hosting site. If you don't have one already, you can use imgur.com