I have files of the format:
20151002_1910_IMG_2454.jpg
The first part is YYYYMMDD and the second part is HHMM of the CreateDate. The last part after the underscore is the original filename. Well, what was once the original filename.
Now, I'd like to convert the filename to be more apparent as to what the filename parts are:
YYYY-MM-DD_at_HHhMMmSSs_{Last Part of current filename}.
I know i can do this with regular expressions, but i'm not sure how. I need to grab from the 15th character until the period before the extension, and insert that after the formatted Create Date. Can anyone help?
Something like this:
exiftool -d %Y-%m-%d_at_%Hh%Mm%Ss_${Filename?????}.%%e '-filename<CreateDate'
Not sure what to put for ${Filename???????}
You can't use $filename in the date format string, but this should give you what you want:
exiftool -d '%Y-%m-%d_at_%Hh%Mm%Ss' '-filename<${createdate}_${filename;s/.*_//;s/\..*//}' FILEsOrDirs
(on windows, change single quotes to double quotes)
Thanks. That looks close. But
20040123_1926_IMG_0002.JPG
is renamed to
2004-01-23_at_19h26m39s_0002
Needs the full original filename (IMG_0002) in it, not just the last part of it.
Just remove s/.*_//; from the filename formatting then (this removes all characters up to and including the underline).
- Phil
Still struggling at this since I'm afraid the above suggestions didn't work. I need to capture everything starting from the 15th character (any type) up until right before the period for the extension. That's what I want to add onto the newly formatted create date portion of the new file name.
20040123_1926_IMG_0002.JPG
Should be renamed to
2004-01-23_at_19h26m39s_IMG_0002.JPG
But the IMG_0002 portion could be anything
Try '-filename<${createdate}_${filename;s/.{14}//}'
That will remove the first 14 characters.
That worked. Thanks!
Thanks StarGeek. I didn't read carefully enough.
- Phil