I need to rename files that are (accidentally) named like:
2016-11-11_at_22h55m00056.MTS
YYYY-MM-DD_at_HHhMMmXXXXX.MTS
I need to extract the XXXXX (the last 5 characters before the period/extension). And then rename to:
YYYY-MM-DD_at_HHhMMmSSs_XXXXX.MTS (the seconds need to be added after the minutes)
So it would look more like
2016-11-11_at_22h55m45s_00056.MTS
I know how to do what i need if I would run this on the original file named 00056.MTS. It would be:
/usr/local/bin/exiftool -d /Volumes/video/%Y/%m/%Y-%m-%d_at_%Hh%Mm$Ss_%%f.%%e '-filename<DateTimeOriginal' filename
But now that I ran this command once with the wrong format, I need another command that will simply rename the file. But I don't know how to use regular expressions for this. Help?
One of the advanced options for the %f variable is to grab characters from the end of the filename (excluding the extension). So try your normal command but instead of %%f, try %%-5f. Use TestName instead of Filename to test without making changes.
Where are the advanced options for the %f variable documented, please?
The percent variables are documented under the -w (textout) option (https://exiftool.org/exiftool_pod.html#w-EXT-or-FMT--textOut).
Thanks!