Hey, everybody!
I am trying to rename photos using the pattern "YYYYYYMMDD_HHMMSS_gmtOFFSET.ext", where OFFSET is 4 characters (4 digits) for positive offset or 5 characters (minus sign and 4 digits) for negative offset. For example:
- 20231114_202653_gmt0500.HEIC
- 20231112_091528_gmt0300.HEIC
- 20231110_171736_gmt-0100.HEIC
At the terminal on macOS, I do the following:
exiftool '-testname<${DateTimeOriginal}_gmt${OffsetTime}.%e' -d '%Y-%m-%d_%H-%M-%S%' .As a result, I get the characters "plus" and "colon" in the offset part:
- 20231114_202653_gmt+05:00.HEIC
- 20231112_091528_gmt+03:00.HEIC
- 20231110_171736_gmt-01:00.HEIC
Is there an option to set a formatting pattern for the OffsetTime tag? Or perhaps there is another way to solve the problem?
Quote from: StarGeek on November 14, 2023, 10:47:40 AMTry using
${OffsetTime;s/[+:]//g}
This will remove any + or : in the offset time tag.
StarGeek, you made my evening! Thank you for the quick reply.
Just a very minor point, but using tr/// (translate) instead of s/// (substitute) is a more efficient way to remove characters:
${OffsetTime;tr/+://d}
- Phil
Quote from: Phil Harvey on November 14, 2023, 12:31:46 PMJust a very minor point, but using tr/// (translate) instead of s/// (substitute) is a more efficient way to remove characters:
${OffsetTime;tr/+://d}
- Phil
Phil, thank you for your reply as well!