ExifTool Forum

ExifTool => Newbies => Topic started by: gnulab on October 22, 2022, 11:20:22 AM

Title: Add SubSeconds to Filename
Post by: gnulab on October 22, 2022, 11:20:22 AM
Hi,

I am trying to rename my JPG files to this format yyyymmdd-hhmmss.SSS.jpg

The example on https://exiftool.org/ gives this

"exiftool(-k).exe" "-FileName<CreateDate" -d "%Y%m%d_%H%M%S.%%e" DIR

I modified it to this

"exiftool(-k).exe" "-FileName<CreateDate" -d "%Y%m%d_%H%M%S%3f.%%e" DIR

but it results in 20221016_144137.000.jpg
What is missing?


Thank you.
Title: Re: Add SubSeconds to Filename
Post by: StarGeek on October 22, 2022, 12:03:50 PM
The EXIF:CreateDate does not include subseconds.  That data (and time zone) are recorded in a separate tag.

You have a couple of choices.  You can either include move the %e from the date format string and include the subseconds tag in your rename
exiftool "-FileName<${CreateDate}.$SubSecTimeDigitized.%e" -d "%Y%m%d_%H%M%S" DIR

Or use the Composite (https://exiftool.org/TagNames/Composite.html) tag that exiftool creates on the fly that includes the subseconds
exiftool "-FileName<SubSecCreateDate" -d "%Y%m%d_%H%M%S%3f.%%e" DIR