ExifTool comes to the rescue when I need to fix the date and time in a batch of photo files

Before departing on an overseas trip recently I configured my camera to have the correct date and time at home (BST time zone). Of course I forgot to reconfigure the camera to the local time at my destination. On top of that, for some reason I still do not know, the date in the camera got changed. Anyway, I ended up with a large number of photos with EXIF data containing the wrong date and time. For example, I took one photo on 2011:08:04 at 09:19:03 local time but the EXIF data in the JPEG file was 2011:07:25 02:19:03.

So I needed to find a way to correct the date and time in all the photos in one fell swoop. Enter ExifTool, an excellent command line tool written in Perl. See ExifTool by Phil Harvey for full details and the download page.

To install it, I downloaded Image-ExifTool-8.61.tar.gz and followed the instructions on Installing ExifTool on Unix Platforms.

I’m going to show you how I fixed my photos. There is a lot of console output in this article because I want to give you actual examples of how to use the ExifTool commands, as it took me a while to understand the detailed documentation for the tool.

In order to fix my photos, I first copied into the ExifTool directory the directory containing the photos.

Then I used ExifTool to check the EXIF data in one of the photos, to see which tags needed to be corrected:

fitzcarraldo@meshedgedx ~ $ cd ExifTool/Image-ExifTool-8.61
fitzcarraldo@meshedgedx ~/ExifTool/Image-ExifTool-8.61 $ ./exiftool Photos_04_08_2011/DSC00006.JPG
ExifTool Version Number : 8.61
File Name : DSC00006.JPG
Directory : Photos_04_08_2011
File Size : 1405 kB
File Modification Date/Time : 2011:08:10 09:44:27+01:00 <------- This was the date and time that I last modified this file.
File Permissions : rwxrwxrwx
File Type : JPEG
MIME Type : image/jpeg
Exif Byte Order : Little-endian (Intel, II)
Image Description :
Make : SONY
Camera Model Name : DSC-WX7
Orientation : Horizontal (normal)
X Resolution : 72
Y Resolution : 72
Resolution Unit : inches
Modify Date : 2011:07:25 02:19:03 <------- This is the wrong date and time. It should be 2011:08:04 09:19:03.
Y Cb Cr Positioning : Co-sited
Exposure Time : 1/250
F Number : 8.0
Exposure Program : Landscape
ISO : 100
Sensitivity Type : Recommended Exposure Index
Recommended Exposure Index : 100
Exif Version : 0230
Date/Time Original : 2011:07:25 02:19:03 <------- This is the wrong date and time. It should be 2011:08:04 09:19:03.
Create Date : 2011:07:25 02:19:03 <------- This is the wrong date and time. It should be 2011:08:04 09:19:03.
Components Configuration : Y, Cb, Cr, -
Compressed Bits Per Pixel : 2
Brightness Value : 10.15390625
Exposure Compensation : 0
Max Aperture Value : 2.6
Metering Mode : Multi-segment
Light Source : Unknown
Flash : Auto, Did not fire
Focal Length : 4.5 mm
Panorama Full Width : 0
Panorama Full Height : 0
Panorama Direction : Right to Left
Panorama Crop Left : 0
Panorama Crop Top : 0
Panorama Crop Right : 0
Panorama Crop Bottom : 0
Panorama Frame Width : 0
Panorama Frame Height : 0
Panorama Source Width : 0
Panorama Source Height : 0
Brightness : 0
High ISO Noise Reduction : n/a
HDR : Off
Face Info Offset : 94
Sony Date Time : 2011:07:25 02:19:03 <------- This is the wrong date and time. It should be 2011:08:04 09:19:03.
Faces Detected : 0
Face Info Length : 37
Color Reproduction : Standard
Color Temperature : 4294967295
Color Compensation Filter : -1
Scene Mode : n/a
Zone Matching : ISO Setting Used
Image Stabilization : On
Color Mode : n/a
Macro : Off
Focus Mode : Permanent-AF
AF Mode : Default
AF Illuminator : Auto
Quality : Normal
Flash Level : Unknown (128)
Release Mode : Normal
Sequence Number : Single
Anti-Blur : On (Shooting)
Long Exposure Noise Reduction : Unknown (2)
Dynamic Range Optimizer : Standard
Intelligent Auto : On
White Balance : Auto
User Comment :
Flashpix Version : 0100
Color Space : sRGB
Exif Image Width : 2592
Exif Image Height : 1944
Interoperability Index : R98 - DCF basic file (sRGB)
Interoperability Version : 0100
File Source : Digital Camera
Scene Type : Directly photographed
Custom Rendered : Normal
Exposure Mode : Auto
Digital Zoom Ratio : 1
Scene Capture Type : Landscape
Contrast : Normal
Saturation : Normal
Sharpness : Normal
Lens Info : 4.5-22.5mm f/2.6-6.3
PrintIM Version : 0300
Compression : JPEG (old-style)
Thumbnail Offset : 13588
Thumbnail Length : 8277
MPF Version : 0100
Number Of Images : 2
MP Image Flags : Dependent child image
MP Image Format : JPEG
MP Image Type : Large Thumbnail (full HD equivalent)
MP Image Length : 343933
MP Image Start : 1095165
Dependent Image 1 Entry Number : 0
Dependent Image 2 Entry Number : 0
Image Width : 2592
Image Height : 1944
Encoding Process : Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components : 3
Y Cb Cr Sub Sampling : YCbCr4:2:2 (2 1)
Aperture : 8.0
Image Size : 2592x1944
Preview Image : (Binary data 343933 bytes, use -b option to extract)
Shutter Speed : 1/250
Thumbnail Image : (Binary data 8277 bytes, use -b option to extract)
Focal Length : 4.5 mm
Light Value : 14.0

I found four tags were incorrect in the file: ‘Modify Date’, ‘Date/Time Original’, ‘Create Date’ and ‘Sony Date Time’. However, before using ExifTool on all four tags and on the whole batch of photos, I first tried fixing only the tag ‘Sony Date Time’ in this single photo, to see if that would work:

fitzcarraldo@meshedgedx ~/ExifTool/Image-ExifTool-8.61 $ ./exiftool "-SonyDateTime+=0:00:10 07:00:0" Photos_04_08_2011/DSC00006.JPG

and then I checked the photo’s meta data again to see if the tag had been changed correctly:

fitzcarraldo@meshedgedx ~/ExifTool/Image-ExifTool-8.61 $ ./exiftool Photos_04_08_2011/DSC00006.JPG
ExifTool Version Number : 8.61
File Name : DSC00006.JPG
Directory : Photos_04_08_2011
File Size : 1405 kB
File Modification Date/Time : 2011:08:10 09:45:16+01:00 <------- This was the date and time when I ran ExifTool to change 'Sony Date Time' in this file.
File Permissions : rwxrwxrwx
File Type : JPEG
MIME Type : image/jpeg
Exif Byte Order : Little-endian (Intel, II)
Image Description :
Make : SONY
Camera Model Name : DSC-WX7
Orientation : Horizontal (normal)
X Resolution : 72
Y Resolution : 72
Resolution Unit : inches
Modify Date : 2011:07:25 02:19:03 <------- Notice it is still wrong, as I didn't try to change it.
Y Cb Cr Positioning : Co-sited
Exposure Time : 1/250
F Number : 8.0
Exposure Program : Landscape
ISO : 100
Sensitivity Type : Recommended Exposure Index
Recommended Exposure Index : 100
Exif Version : 0230
Date/Time Original : 2011:07:25 02:19:03 <------- Notice it is still wrong, as I didn't try to change it.
Create Date : 2011:07:25 02:19:03 <------- Notice it is still wrong, as I didn't try to change it.
Components Configuration : Y, Cb, Cr, -
Compressed Bits Per Pixel : 2
Brightness Value : 10.15390625
Exposure Compensation : 0
Max Aperture Value : 2.6
Metering Mode : Multi-segment
Light Source : Unknown
Flash : Auto, Did not fire
Focal Length : 4.5 mm
Panorama Full Width : 0
Panorama Full Height : 0
Panorama Direction : Right to Left
Panorama Crop Left : 0
Panorama Crop Top : 0
Panorama Crop Right : 0
Panorama Crop Bottom : 0
Panorama Frame Width : 0
Panorama Frame Height : 0
Panorama Source Width : 0
Panorama Source Height : 0
Brightness : 0
High ISO Noise Reduction : n/a
HDR : Off
Face Info Offset : 94
Sony Date Time : 2011:08:04 09:19:03 <------- Notice it is now correct.
Faces Detected : 0
Face Info Length : 37
Color Reproduction : Standard
Color Temperature : 4294967295
Color Compensation Filter : -1
Scene Mode : n/a
Zone Matching : ISO Setting Used
Image Stabilization : On
Color Mode : n/a
Macro : Off
Focus Mode : Permanent-AF
AF Mode : Default
AF Illuminator : Auto
Quality : Normal
Flash Level : Unknown (128)
Release Mode : Normal
Sequence Number : Single
Anti-Blur : On (Shooting)
Long Exposure Noise Reduction : Unknown (2)
Dynamic Range Optimizer : Standard
Intelligent Auto : On
White Balance : Auto
User Comment :
Flashpix Version : 0100
Color Space : sRGB
Exif Image Width : 2592
Exif Image Height : 1944
Interoperability Index : R98 - DCF basic file (sRGB)
Interoperability Version : 0100
File Source : Digital Camera
Scene Type : Directly photographed
Custom Rendered : Normal
Exposure Mode : Auto
Digital Zoom Ratio : 1
Scene Capture Type : Landscape
Contrast : Normal
Saturation : Normal
Sharpness : Normal
Lens Info : 4.5-22.5mm f/2.6-6.3
PrintIM Version : 0300
Compression : JPEG (old-style)
Thumbnail Offset : 13588
Thumbnail Length : 8277
MPF Version : 0100
Number Of Images : 2
MP Image Flags : Dependent child image
MP Image Format : JPEG
MP Image Type : Large Thumbnail (full HD equivalent)
MP Image Length : 343933
MP Image Start : 1095165
Dependent Image 1 Entry Number : 0
Dependent Image 2 Entry Number : 0
Image Width : 2592
Image Height : 1944
Encoding Process : Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components : 3
Y Cb Cr Sub Sampling : YCbCr4:2:2 (2 1)
Aperture : 8.0
Image Size : 2592x1944
Preview Image : (Binary data 343933 bytes, use -b option to extract)
Shutter Speed : 1/250
Thumbnail Image : (Binary data 8277 bytes, use -b option to extract)
Focal Length : 4.5 mm
Light Value : 14.0

So it looked like ExifTool would do the job. But I was still cautious, so I then used ExifTool to change the tags ‘Modify Date’, ‘Date/Time Original’, ‘Create Date’ and ‘Sony Date Time’ in another photo, just to check they would all be changed correctly, and I doublechecked the dates and times in the EXIF data, this time by using the ExifTool command switches -a -u and -g1 to group the meta data:

fitzcarraldo@meshedgedx ~/ExifTool/Image-ExifTool-8.61 $ ./exiftool -a -u -g1 Photos_04_08_2011/DSC00168.JPG
---- ExifTool ----
ExifTool Version Number : 8.61
---- System ----
File Name : DSC00168.JPG
Directory : .
File Size : 1854 kB
File Modification Date/Time : 2011:08:11 06:30:30+01:00
File Permissions : rwxrwxrwx
---- File ----
File Type : JPEG
MIME Type : image/jpeg
Exif Byte Order : Little-endian (Intel, II)
Image Width : 2592
Image Height : 1944
Encoding Process : Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components : 3
Y Cb Cr Sub Sampling : YCbCr4:2:2 (2 1)
---- IFD0 ----
Image Description :
Make : SONY
Camera Model Name : DSC-WX7
Orientation : Horizontal (normal)
X Resolution : 72
Y Resolution : 72
Resolution Unit : inches
Modify Date : 2011:08:04 15:30:20 <------- Fixed.
Y Cb Cr Positioning : Co-sited
---- ExifIFD ----
Exposure Time : 1/30
F Number : 2.6
Exposure Program : Program AE
ISO : 400
Sensitivity Type : Recommended Exposure Index
Recommended Exposure Index : 400
Exif Version : 0230
Date/Time Original : 2011:08:04 15:30:20 <------- Fixed.
Create Date : 2011:08:04 15:30:20 <------- Fixed.
Components Configuration : Y, Cb, Cr, -
Compressed Bits Per Pixel : 2
Brightness Value : 1.17734375
Exposure Compensation : 0
Max Aperture Value : 2.6
Metering Mode : Multi-segment
Light Source : Unknown
Flash : Off, Did not fire
Focal Length : 4.5 mm
User Comment :
Flashpix Version : 0100
Color Space : sRGB
Exif Image Width : 2592
Exif Image Height : 1944
File Source : Digital Camera
Scene Type : Directly photographed
Custom Rendered : Normal
Exposure Mode : Auto
White Balance : Auto
Digital Zoom Ratio : 1
Scene Capture Type : Standard
Contrast : Normal
Saturation : Normal
Sharpness : Normal
Lens Info : 4.5-22.5mm f/2.6-6.3
---- Sony ----
Panorama Full Width : 0
Panorama Full Height : 0
Panorama Direction : Right to Left
Panorama Crop Left : 0
Panorama Crop Top : 0
Panorama Crop Right : 0
Panorama Crop Bottom : 0
Panorama Frame Width : 0
Panorama Frame Height : 0
Panorama Source Width : 0
Panorama Source Height : 0
Sony 0x2000 : 0
Sony 0x2002 : 0
Sony 0x2003 : �������������������������������������������������������[...]
Contrast : 0
Saturation : -1
Sharpness : -1
Brightness : 0
Long Exposure Noise Reduction : n/a
High ISO Noise Reduction : n/a
HDR : Off
Sony 0x200c : 0 0 0
Sony 0x200d : 1
Face Info Offset : 94
Sony Date Time : 2011:08:04 15:30:20 <------- Fixed.
Faces Detected : 0
Face Info Length : 37
Color Reproduction : Standard
Color Temperature : 4294967295
Color Compensation Filter : -1
Scene Mode : n/a
Zone Matching : ISO Setting Used
Dynamic Range Optimizer : Standard
Image Stabilization : On
Color Mode : n/a
Macro : Off
Exposure Mode : Program
Focus Mode : Permanent-AF
AF Mode : Default
AF Illuminator : Auto
Sony 0xb045 : 0
Sony 0xb046 : 0
Quality : Normal
Flash Level : Unknown (128)
Release Mode : Normal
Sequence Number : Single
Anti-Blur : On (Shooting)
Sony 0xb04c : 1
Sony 0xb04d : 0
Long Exposure Noise Reduction : Unknown (2)
Dynamic Range Optimizer : Standard
Sony 0xb050 : 2
Sony 0xb051 : 0
Intelligent Auto : On
Sony 0xb053 : 0
White Balance : Auto
Sony 0x9400 : ...........��[...]
Sony 0x9401 : c���....��.����.�D��..�.0b0.L��e�e0E0.L��.[...]
Sony 0x9402 : .l���i.p!�!�����i���V�ie�Pp_��}@i�[...]
Sony 0x9403 : .��.i.��.榚~W��...���[...]
Sony 0x9404 : @�..�.�@}.��.�.0�K��pl.�V���.�..͵�QV..MV[...]
Sony 0x9405 : ..��.��Ģ�E5�..�..[...]
Sony 0x9406 : �������������������������������������������������������[...]
Sony 0x9407 : �������������������������������������������������������[...]
Sony 0x9408 : .#?A??AA��...�[...]
Sony 0x9409 : .[...]
Sony 0x940a : ��.��[...]
Sony 0x940b : �.�@�@�}�}t}.@�@PpFpNp�p��.�Ҋ_�9�~���v͔� ͸����^�.�[...]
Sony 0x940c : ������[...]
Sony 0x940d : �������������������������������������������������������[...]
Sony 0x940e : �������������������������������������������������������[...]
Sony 0xa100 : [...]
---- InteropIFD ----
Interoperability Index : R98 - DCF basic file (sRGB)
Interoperability Version : 0100
---- PrintIM ----
PrintIM Version : 0300
Print IM 0x0002 : 0x00000001
Print IM 0x0101 : 0x00000001
---- IFD1 ----
Compression : JPEG (old-style)
Image Description :
Make : SONY
Camera Model Name : DSC-WX7
Orientation : Horizontal (normal)
X Resolution : 72
Y Resolution : 72
Resolution Unit : inches
Modify Date : 2011:07:25 08:30:20 <------- Whoops, this one is still incorrect.
Thumbnail Offset : 13588
Thumbnail Length : 12400
Y Cb Cr Positioning : Co-sited
---- MPF0 ----
MPF Version : 0100
Number Of Images : 2
---- MPImage1 ----
MP Image Flags : Representative image, Dependent parent image
MP Image Format : JPEG
MP Image Type : Baseline MP Primary Image
MP Image Length : 1399500
MP Image Start : 0
Dependent Image 1 Entry Number : 2
Dependent Image 2 Entry Number : 0
---- MPImage2 ----
MP Image Flags : Dependent child image
MP Image Format : JPEG
MP Image Type : Large Thumbnail (full HD equivalent)
MP Image Length : 496491
MP Image Start : 1402364
Dependent Image 1 Entry Number : 0
Dependent Image 2 Entry Number : 0
---- Composite ----
Aperture : 2.6
Image Size : 2592x1944
Preview Image : (Binary data 496491 bytes, use -b option to extract)
Shutter Speed : 1/30
Thumbnail Image : (Binary data 12400 bytes, use -b option to extract)
Focal Length : 4.5 mm
Light Value : 5.7

As you can see from the output above, I found another tag that was also incorrect: ‘Modify Date’ in Group IFD1. So I tried to fix that:

fitzcarraldo@meshedgedx ~/ExifTool/Image-ExifTool-8.61 $ ./exiftool "-IFD1:ModifyDate+=0:00:10 07:00:0" Photos_04_08_2011/DSC00168.JPG
1 image files updated

Notice in the command that I prefixed the tag (ModifyDate) with the group (IFD1).

and I checked the photo’s meta data again:

fitzcarraldo@meshedgedx ~/ExifTool/Image-ExifTool-8.61 $ ./exiftool -a -u -g1 Photos_04_08_2011/DSC00168.JPG
---- ExifTool ----
ExifTool Version Number : 8.61
---- System ----
File Name : DSC00168.JPG
Directory : .
File Size : 1854 kB
File Modification Date/Time : 2011:08:11 06:33:50+01:00
File Permissions : rwxrwxrwx
---- File ----
File Type : JPEG
MIME Type : image/jpeg
Exif Byte Order : Little-endian (Intel, II)
Image Width : 2592
Image Height : 1944
Encoding Process : Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components : 3
Y Cb Cr Sub Sampling : YCbCr4:2:2 (2 1)
---- IFD0 ----
Image Description :
Make : SONY
Camera Model Name : DSC-WX7
Orientation : Horizontal (normal)
X Resolution : 72
Y Resolution : 72
Resolution Unit : inches
Modify Date : 2011:08:04 15:30:20
Y Cb Cr Positioning : Co-sited
---- ExifIFD ----
Exposure Time : 1/30
F Number : 2.6
Exposure Program : Program AE
ISO : 400
Sensitivity Type : Recommended Exposure Index
Recommended Exposure Index : 400
Exif Version : 0230
Date/Time Original : 2011:08:04 15:30:20
Create Date : 2011:08:04 15:30:20
Components Configuration : Y, Cb, Cr, -
Compressed Bits Per Pixel : 2
Brightness Value : 1.17734375
Exposure Compensation : 0
Max Aperture Value : 2.6
Metering Mode : Multi-segment
Light Source : Unknown
Flash : Off, Did not fire
Focal Length : 4.5 mm
User Comment :
Flashpix Version : 0100
Color Space : sRGB
Exif Image Width : 2592
Exif Image Height : 1944
File Source : Digital Camera
Scene Type : Directly photographed
Custom Rendered : Normal
Exposure Mode : Auto
White Balance : Auto
Digital Zoom Ratio : 1
Scene Capture Type : Standard
Contrast : Normal
Saturation : Normal
Sharpness : Normal
Lens Info : 4.5-22.5mm f/2.6-6.3
---- Sony ----
Panorama Full Width : 0
Panorama Full Height : 0
Panorama Direction : Right to Left
Panorama Crop Left : 0
Panorama Crop Top : 0
Panorama Crop Right : 0
Panorama Crop Bottom : 0
Panorama Frame Width : 0
Panorama Frame Height : 0
Panorama Source Width : 0
Panorama Source Height : 0
Sony 0x2000 : 0
Sony 0x2002 : 0
Sony 0x2003 : �������������������������������������������������������[...]
Contrast : 0
Saturation : -1
Sharpness : -1
Brightness : 0
Long Exposure Noise Reduction : n/a
High ISO Noise Reduction : n/a
HDR : Off
Sony 0x200c : 0 0 0
Sony 0x200d : 1
Face Info Offset : 94
Sony Date Time : 2011:08:04 15:30:20
Faces Detected : 0
Face Info Length : 37
Color Reproduction : Standard
Color Temperature : 4294967295
Color Compensation Filter : -1
Scene Mode : n/a
Zone Matching : ISO Setting Used
Dynamic Range Optimizer : Standard
Image Stabilization : On
Color Mode : n/a
Macro : Off
Exposure Mode : Program
Focus Mode : Permanent-AF
AF Mode : Default
AF Illuminator : Auto
Sony 0xb045 : 0
Sony 0xb046 : 0
Quality : Normal
Flash Level : Unknown (128)
Release Mode : Normal
Sequence Number : Single
Anti-Blur : On (Shooting)
Sony 0xb04c : 1
Sony 0xb04d : 0
Long Exposure Noise Reduction : Unknown (2)
Dynamic Range Optimizer : Standard
Sony 0xb050 : 2
Sony 0xb051 : 0
Intelligent Auto : On
Sony 0xb053 : 0
White Balance : Auto
Sony 0x9400 : ...........��[...]
Sony 0x9401 : c���....��.����.�D��..�.0b0.L��e�e0E0.L��.[...]
Sony 0x9402 : .l���i.p!�!�����i���V�ie�Pp_��}@i�[...]
Sony 0x9403 : .��.i.��.榚~W��...���[...]
Sony 0x9404 : @�..�.�@}.��.�.0�K��pl.�V���.�..͵�QV..MV[...]
Sony 0x9405 : ..��.��Ģ�E5�..�..[...]
Sony 0x9406 : �������������������������������������������������������[...]
Sony 0x9407 : �������������������������������������������������������[...]
Sony 0x9408 : .#?A??AA��...�[...]
Sony 0x9409 : .[...]
Sony 0x940a : ��.��[...]
Sony 0x940b : �.�@�@�}�}t}.@�@PpFpNp�p��.�Ҋ_�9�~���v͔� ͸����^�.�[...]
Sony 0x940c : ������[...]
Sony 0x940d : �������������������������������������������������������[...]
Sony 0x940e : �������������������������������������������������������[...]
Sony 0xa100 : [...]
---- InteropIFD ----
Interoperability Index : R98 - DCF basic file (sRGB)
Interoperability Version : 0100
---- PrintIM ----
PrintIM Version : 0300
Print IM 0x0002 : 0x00000001
Print IM 0x0101 : 0x00000001
---- IFD1 ----
Compression : JPEG (old-style)
Image Description :
Make : SONY
Camera Model Name : DSC-WX7
Orientation : Horizontal (normal)
X Resolution : 72
Y Resolution : 72
Resolution Unit : inches
Modify Date : 2011:08:04 15:30:20 <------- Notice it is now correct.
Thumbnail Offset : 13588
Thumbnail Length : 12400
Y Cb Cr Positioning : Co-sited
---- MPF0 ----
MPF Version : 0100
Number Of Images : 2
---- MPImage1 ----
MP Image Flags : Representative image, Dependent parent image
MP Image Format : JPEG
MP Image Type : Baseline MP Primary Image
MP Image Length : 1399500
MP Image Start : 0
Dependent Image 1 Entry Number : 2
Dependent Image 2 Entry Number : 0
---- MPImage2 ----
MP Image Flags : Dependent child image
MP Image Format : JPEG
MP Image Type : Large Thumbnail (full HD equivalent)
MP Image Length : 496491
MP Image Start : 1402364
Dependent Image 1 Entry Number : 0
Dependent Image 2 Entry Number : 0
---- Composite ----
Aperture : 2.6
Image Size : 2592x1944
Preview Image : (Binary data 496491 bytes, use -b option to extract)
Shutter Speed : 1/30
Thumbnail Image : (Binary data 12400 bytes, use -b option to extract)
Focal Length : 4.5 mm
Light Value : 5.7

Now I was confident that I could fix all the incorrect tags, so I again copied the directory containing the original files into the ExifTool directory and used the commands below to change the date and time from e.g. 2011:07:25 02:19:03 to 2011:08:04 09:19:03, i.e. I wanted to: a) add 7 hours to the EXIF times to make them correct for the city I was in instead of UK BST; b) add 10 days to the EXIF dates to fix the incorrect date (2011:07:25) that was set in my camera to the correct date (2011:08:04).

$ cd ~/ExifTool/Image-ExifTool-8.61
$ ./exiftool "-SonyDateTime+=0:00:10 07:00:0" Photos_04_08_2011/
$ ./exiftool "-DateTimeOriginal+=0:00:10 07:00:0" Photos_04_08_2011/
$ ./exiftool "-CreateDate+=0:00:10 07:00:0" Photos_04_08_2011/
$ ./exiftool "-IFD0:ModifyDate+=0:00:10 07:00:0" Photos_04_08_2011/
$ ./exiftool "-IFD1:ModifyDate+=0:00:10 07:00:0" Photos_04_08_2011/

Finally, as ExifTool automatically creates a back up file before changing EXIF data in a photo file, I deleted the back up files after I had checked that the EXIF data in the new files contained the correct dates and times:

$ rm ./Photos_04_08_2011/*_original

Yet another great tool to add to my toolbox.

About these ads

About Fitzcarraldo
A Linux user with an interest in all things technical.

3 Responses to ExifTool comes to the rescue when I need to fix the date and time in a batch of photo files

  1. Phil Harvey says:

    Well done. Note that this all may be accomplished with a single exiftool command:

    exiftool “-SonyDateTime+=0:00:10 07:00:0″ “-DateTimeOriginal+=0:00:10 07:00:0″ “-CreateDate+=0:00:10 07:00:0″ “-IFD0:ModifyDate+=0:00:10 07:00:0″ “-IFD1:ModifyDate+=0:00:10 07:00:0″ Photos_04_08_2011/

    further, this can be simplified using an exiftool shortcut called “AllDates” which writes the DateTimeOrigina, CreateDate and ModifyDate (note that it writes the standard IFD0 location, so you must still set the IFD1 tags manually):

    exiftool “-SonyDateTime+=0:00:10 07:00:0″ “-AllDates+=0:00:10 07:00:0″ “-IFD1:ModifyDate+=0:00:10 07:00:0″ Photos_04_08_2011/

  2. grateful visitor says:

    Oh man you save me a lot of time this time :)
    I have tried some progs (incl. one windows GUI for exiftool) but with no success at all with IFD1:ModifyDate modification.
    With your and Phil’s guidance I accomplished my task in no time.
    And that incrementing date… just cute!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 50 other followers

%d bloggers like this: