ExifTool Forum

ExifTool => Newbies => Topic started by: lmiol on June 13, 2023, 06:57:15 PM

Title: Rename file include OffsetTimeOriginal
Post by: lmiol on June 13, 2023, 06:57:15 PM
Hi Gurus
JPF file contains
OffsetTimeOriginal +03:00
DateTimeOriginal 2023:06:03 15:54:17


this one
exiftool "-filename<PXL_${DateTimeOriginal}.%e" -d %Y%m%d_%H%M%S .
does this filename PXL_20230603_155417.jpg

how to rename to datetimeoriginal minus OffsetTimeOriginal
to get this one PXL_20230603_125417.jpg

i tried to read examples and search forum, nothing =(

Regards
Title: Re: Rename file include OffsetTimeOriginal
Post by: StarGeek on June 13, 2023, 08:14:38 PM
The easiest would be to do it in two steps.  Copy SubSecDateTimeOriginal to the GPS time stamps, which are in UTC.  And then use them to change the filename.

exiftool "-gps*stamp<SubSecDateTimeOriginal" /path/to/files/
exiftool "-filename<PXL_${GPSDateTime}.%e" -d %Y%m%d_%H%M%S /path/to/files/

If the camera already captures GPS coordinates, then the GPS time stamps should already exist and you could then use the second command directly.

Doing it in one command is much more complex and messy.  You have to remove the -d (-dateFormat) option (https://exiftool.org/exiftool_pod.html#d-FMT--dateFormat) and instead use the DateFmt helper function (https://exiftool.org//exiftool_pod.html#Helper-functions).

C:\Programs\My_Stuff>exiftool -G -a -s -DateTimeOriginal -OffsetTimeOriginal y:\!temp\Test4.jpg
[EXIF]          DateTimeOriginal                : 2023:06:03 15:00:00
[EXIF]          OffsetTimeOriginal              : +03:00

C:\>exiftool "-testname<PXL_${DateTimeOriginal;my $temp=$self->GetValue('OffsetTimeOriginal');$temp=~tr/-+/+-/;ShiftTime($temp);DateFmt('%Y%m%d_%H%M%S')}.%e" y:\!temp\Test4.jpg
'y:/!temp/Test4.jpg' --> 'y:/!temp/PXL_20230603_120000.jpg'
    0 image files updated
    1 image files unchanged
Title: Re: Rename file include OffsetTimeOriginal
Post by: lmiol on June 14, 2023, 05:07:26 AM
very thanks
all this solutions is good!

Quote from: StarGeek on June 13, 2023, 08:14:38 PMIf the camera already captures GPS coordinates...
and no, i work with alot of files from different people,
some enable GEO on phone some not, so i need 100% solution
and it seems big one command is usefull for me!
very very thank you!
probably this forum needs "Thank you" button and "Donate" button :D
Title: Re: Rename file include OffsetTimeOriginal
Post by: StarGeek on June 14, 2023, 11:42:39 AM
Quote from: lmiol on June 14, 2023, 05:07:26 AM"Donate" button :D

See the front page (https://exiftool.org/#donate).
Title: Re: Rename file include OffsetTimeOriginal
Post by: lmiol on June 19, 2023, 12:54:06 PM
Quote from: StarGeek on June 14, 2023, 11:42:39 AM
Quote from: lmiol on June 14, 2023, 05:07:26 AM"Donate" button :D

See the front page (https://exiftool.org/#donate).
i dont have paypal (and cant create it) but i have bitcoin