Parsing a date out of a filename -- help!

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Parsing a date out of a filename -- help! 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
gold7181
 
Posts: 4
Joined: Tue Dec 31, 2013 8:57 pm

Re: Parsing a date out of a filename -- help! 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?
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Parsing a date out of a filename -- help! 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! ?
gold7181
 
Posts: 4
Joined: Tue Dec 31, 2013 8:57 pm

Re: Parsing a date out of a filename -- help! 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
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support

cron