#1 : 04/05-24 05:55 Henry
Posts: 6
|
Hi,
I had read few posts about changing date format. However most have delimiter such as 21.07.2023. My files do not have delimiter, so it appears as ESE17170723081002127081180723. I would like to change the last 6 digits to the following: 230718 2023-07-18 (year-month-date) 2023-07 (year-month) 23-07 (year-month) 2307 (year-month) Thank you. |
#2 : 04/05-24 07:42 Delta Foxtrot
Posts: 324
|
Reply to #1:
Hi Henry, Actually you do have a delimiter, the end of filename. In regex that's "$". So all you need is to separate the two-digit sections of the date and (in regex terms) anchor it with the end-of-filename code. In a replace method it would look like: Text to replace: (\d\d)(\d\d)(\d\d)$ (no spaces) Replace with: 20$3-$2-$1 (no spaces) Regex ON Apply to: Name Leave the dashes out if you don't want them, and leave off $1 if you don't want the day number. You were a little unclear about what format you actually wanted to end up with. You also didn't say if the month and day are always zero-padded, but I'm assuming you would have mentioned it if they weren't. You also didn't say where in the filename you want the date to end up; the regex above will leave it at the end. If you want it at the beginning: Text to replace: (.*)(\d\d)(\d\d)(\d\d)$ (no spaces) Replace with: 20$4-$3-$2_$1 (no spaces) Regex ON (I used an underscore to separate the date, but you could use whatever, or nothing) Let us know if that's not what you were asking for. :) Best, DF |
#3 : 04/05-24 07:48 Henry
Posts: 6
|
Reply to #2:
Ahh, okok. I tried it on my own and had to replace the first 23 characters with the value 20. LOL. Managed to figure out about swapping. Thanks once again. |
#4 : 04/05-24 08:14 Delta Foxtrot
Posts: 324
|
Reply to #3:
Yeah, that sounds tedious. If all your filenames are 23 characters plus the date, that in itself is a delimiter that you could use, like this (again, putting the date at the start): TTR: (.{23})(..)(..)(..) RW: 20$4$3$2_$1 Anyway, just another way to thread the needle... Cheers! |