Discussion:
Change EXIF and File dates
(too old to reply)
m***@gmail.com
2008-09-29 20:31:42 UTC
Permalink
I have few hundreds of *.JPG files given to me. Camera clock was set
up wrong. Instead of 09/27/2008 20:40 PM it shows 12/23/2008 1:29 PM.
I'd like to get a batch to change all File and EXIF date properties.


I need to read "Date/Time Original", subtract 124849 minutes then
change all Data fields (except LastAccessTime)


PS C:\Temp> get-childitem C:\111\CIMG2865.JPG |format-list


Directory: Microsoft.PowerShell.Core\FileSystem::C:\111



Name : CIMG2865.JPG
Length : 4193300
CreationTime : 9/27/2008 12:29:14 PM
LastWriteTime : 9/27/2008 12:29:14 PM
LastAccessTime : 9/27/2008 12:31:24 PM
VersionInfo :



PS C:\Temp> C:\util\Exif\exiftool.exe -a -u -g1 C:\111\CIMG2865.JPG
---- ExifTool ----
ExifTool Version Number : 7.36
---- File ----
File Name : CIMG2865.JPG
Directory : C:\111
File Size : 4 MB
File Modification Date/Time : 2008:09:27 12:29:14
Modify Date : 2008:12:23 13:29:23
Date/Time Original : 2008:12:23 13:29:23
Create Date : 2008:12:23 13:29:23
...


Did anyone have such batch?
Thank you
Matros
Marco Shaw [MVP]
2008-09-30 11:32:37 UTC
Permalink
Post by m***@gmail.com
I have few hundreds of *.JPG files given to me. Camera clock was set
up wrong. Instead of 09/27/2008 20:40 PM it shows 12/23/2008 1:29 PM.
I'd like to get a batch to change all File and EXIF date properties.
I need to read "Date/Time Original", subtract 124849 minutes then
change all Data fields (except LastAccessTime)
The help for exiftool mentions:
exiftool -DateTimeOriginal-="0:0:0 1:30:0" dir

Adjust original date/time of all images in directory "dir" by
subtracting one hour and 30 minutes. (This is equivalent to
"-DateTimeOriginal-=1.5". See Image::ExifTool::Shift.pl for
details.)

Mind you the latest online version is 7.44, and you have 7.36.

I didn't play with all the options, but I'm not getting the same
properties returned as you are with the newer version.

I did first go down the road of trying to create a timestamp manually:

PS>$data=(./exiftool some_file)
PS>$year,$month,$day=$data[4].split("")[8].split(":")
PS>$hour,$minute,$combo,$tz1=$data[4].split("")[9].split(":")
PS>$sec,$tz0=$combo.split("-")
PS>$old=[datetime]($month+"/"+$day+"/"+$year+" "+$hour+":"+$minute+":"+$sec)
PS>$new=$old.addminutes(-124849)

But then, I realized that the help doesn't seem to provide a way for you
to use a variable to set any of the timestamp properties.

Long story short, check ./exiftool.exe for the available options.

Marco
--
*Microsoft MVP - Windows Server - Admin Frameworks
https://mvp.support.microsoft.com/profile/Marco.Shaw
*PowerShell Co-Community Director - http://www.powershellcommunity.org
*Blog - http://marcoshaw.blogspot.com
Marco Shaw [MVP]
2008-09-30 12:01:09 UTC
Permalink
Post by Marco Shaw [MVP]
Long story short, check ./exiftool.exe for the available options.
That should be "./exiftool.exe /?" for help.

Marco
--
*Microsoft MVP - Windows Server - Admin Frameworks
https://mvp.support.microsoft.com/profile/Marco.Shaw
*PowerShell Co-Community Director - http://www.powershellcommunity.org
*Blog - http://marcoshaw.blogspot.com
Joel (Jaykul) Bennett
2008-10-02 16:37:23 UTC
Permalink
I wrote this up earlier, and I thought I'd sent it to the list ... I'm
not sure if the example (commented out) in this script will work for
CHANGING exif values, but this script *does* work for FETCHING the
info: http://www.poshcode.org/617

--
Joel "Jaykul" Bennett
Post by m***@gmail.com
I have few hundreds of *.JPG files given to me. Camera clock was set
up wrong. Instead of 09/27/2008 20:40 PM it shows 12/23/2008 1:29 PM.
I'd like to get a batch to change all File and EXIF date properties.
I need to read "Date/Time Original", subtract 124849 minutes then
change all Data fields (except LastAccessTime)
PS C:\Temp> get-childitem C:\111\CIMG2865.JPG |format-list
Directory: Microsoft.PowerShell.Core\FileSystem::C:\111
Name : CIMG2865.JPG
Length : 4193300
CreationTime : 9/27/2008 12:29:14 PM
LastWriteTime : 9/27/2008 12:29:14 PM
LastAccessTime : 9/27/2008 12:31:24 PM
PS C:\Temp> C:\util\Exif\exiftool.exe -a -u -g1 C:\111\CIMG2865.JPG
---- ExifTool ----
ExifTool Version Number : 7.36
---- File ----
File Name : CIMG2865.JPG
Directory : C:\111
File Size : 4 MB
File Modification Date/Time : 2008:09:27 12:29:14
Modify Date : 2008:12:23 13:29:23
Date/Time Original : 2008:12:23 13:29:23
Create Date : 2008:12:23 13:29:23
...
Did anyone have such batch?
Thank you
Matros
Loading...