CreateDate from filemodifydate with -2h shift

Started by DeltaTango, December 23, 2023, 08:32:23 AM

Previous topic - Next topic

DeltaTango

Sorry,

for the easy question but I didn't found an easy solution:

"-datetimeoriginal<filemodifydate-02:00"
didn't work


StarGeek

That's because putting "-02:00" at the end of a time stamp is the format for a time zone.  And the FileModifyDate tag already includes a timezone.  So what you're basically copying would be something like "2023:12:23 12:00:00-08:00-02:00".

To shift the time for all date/time tags, you would use the -GlobalTimeShift option.
exiftool -GlobalTimeShift -2 "-DateTimeOriginal<FileModifyDate" /path/to/files/

Or, if you were copying other time stamps and only wanted to change this one, you would use the ShiftTime helper function
exiftool "-DateTimeOriginal<${FileModifyDate;ShiftTime('-2')}" /path/to/files/
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

DeltaTango

ahh ok, many thanks. And when I want to change the filename with an offset of two hours I tried this

"-filename<${createdate;ShiftTime("2")} -d %Y%m%d_%H%M%S.%%e"
I got following message:

Warning: New file name not allowed in Windows (contains ':') - 20170927(085822).mp4

StarGeek

Your quotes are all messed up.  You changed the single quotes in my example into double quotes and then you didn't have a closing double quote.

Example where I used TestName instead of FileName
C:\>exiftool "-testname<${createdate;ShiftTime('2')}" -d "%Y%m%d_%H%M%S.%%e" y:\!temp\Test4.jpg
'y:/!temp/Test4.jpg' --> 'y:/!temp/20231222_120000.jpg'
    0 image files updated
    1 image files unchanged

In Windows CMD, single quotes are used on anything that needs quotes when surrounded by double quotes. 
"-testname<${createdate;ShiftTime('2')}"

On Mac/Linux, it's the reverse
'-testname<${createdate;ShiftTime("2")}'
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

DeltaTango

#4
Ok - it's a lot of stuff you have in brain und very complicate to remember for me :)

The filename is now the createdate, but without +2h

exiftool -api LargeFileSupport=1 -d "%Y%m%d_%H%M%S_%%C.%%e" "-testname<${createdate;shifttime('2')}" 20170718_145706.MP4
Warning: Undefined subroutine Image::ExifTool::shifttime called for 'createdate' - 20170718_145706.MP4
'20170718_145706.MP4' --> '20170718_145706_0.MP4'
    0 image files updated
    1 image files unchanged

Merry X-mas

Dirk

StarGeek

The case matters for helper functions.  You need to use ShiftTime, not "shifttime".
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype