Changing date and time format in filename

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

Moderator: Mr_Noodle

Changing date and time format in filename Sun Feb 07, 2021 9:52 am • by chrisbunch
I am trying to convert filenames in the format "Scan 30 Jan 2021 at 17.34.pdf" to "Scan 2021-01-30 17.34.pdf"

I can automatically extract the date into a custom date attribute but how do I do likewise for the time? I have tried to extract the time (nn.nn) into a custom text attribute to using the pattern 11.11 but it doesn't match. See screenshots at http://chrisbunch.uk/docs/S4.png and http://chrisbunch.uk/docs/S5.png.

Is this possible? It's a piece of cake with regex (apart from the month) but I gather regex is not available.

Chris
chrisbunch
 
Posts: 12
Joined: Sun Jul 24, 2016 10:13 am

Re: Changing date and time format in filename Mon Feb 08, 2021 11:13 am • by Mr_Noodle
Your pattern has to account for all characters in the name, not just the ones you happen to care about. Also, why not grab the whole thing into the date?
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Thanks Mr N -

I don't get what you mean by 'grab the whole thing into the date'

I am trying to convert filenames in the format 'Scan 25 Aug 2020 at 07.52.pdf' to format 'Scan 2020-08-25 at 07.52.pdf'

A condition 'Name matches' a custom token in the format Image doesn't match.

Even if it did match I'm not clear how to rename it in the action. Is this a task that needs a script? (I have done one in Python)
chrisbunch
 
Posts: 12
Joined: Sun Jul 24, 2016 10:13 am

Re: Changing date and time format in filename Tue Feb 09, 2021 11:23 am • by Mr_Noodle
Name does not include the extension so you need to leave that off the pattern. In your rename pattern, whatever custom date attribute you create will be available to drag in. Drag it in and then click on it to reveal a menu. From there you can edit the date format. You can then specify the date format however you want.
Mr_Noodle
Site Admin
 
Posts: 11255
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

That has cracked it - thank you again.

Chris
________________________
chrisbunch
 
Posts: 12
Joined: Sun Jul 24, 2016 10:13 am


Return to Support