Import missing timestamps, and change files timestamps

Started by enboig, August 10, 2020, 07:23:39 AM

Previous topic - Next topic

enboig

I have two problems:
1) I have and old linux server with lot of images with and without EXIF information. I need to write file timestamp to exif timestamp (I don't know about created, modified, ... timestamps; any advice here is welcome); but just for exif missing files
2) I have a windows server where users want the file timestamp set the same as EXIF, so I have to read (when possible) timestamp from file and change file timestamp (I am admin, so permission shouldn't be an issue).

Thanks

Phil Harvey

1) exiftool '-datetimeoriginal<filemodifydate' -if 'not $datetimeoriginal' -P DIR

2) exiftool '-filemodifydate<datetimeoriginal' DIR

In these commands I am using only EXIF DateTimeOriginal, but there are also EXIF CreateDate and ModifyDate tags that are available.

I've added -P to the first command to preserve the FileModifyDate when writing (otherwise any actual editing of the file will reset this to the current date/time).

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

enboig

Thanks a lot, I was testing with examples from https://ryanmo.co/2014/08/01/find-images-with-no-exif-dates/

Most images would be scanned, so Date/Time Original makes sense.
Should I worry about the missing +02:00?


======== proves.jpg
ExifTool Version Number         : 7.89
File Name                       : proves.jpg
Directory                       : .
File Size                       : 72 kB
File Modification Date/Time     : 2006:10:02 16:37:04+02:00
File Type                       : JPEG
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Exif Byte Order                 : Big-endian (Motorola, MM)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Y Cb Cr Positioning             : Centered
Exif Version                    : 0220
Date/Time Original              : 2006:10:02 16:37:04
Components Configuration        : Y, Cb, Cr, -
Flashpix Version                : 0100
Color Space                     : Uncalibrated
Image Width                     : 600
Image Height                    : 404
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 1
Image Size                      : 600x404
======== proves.jpg_original
ExifTool Version Number         : 7.89
File Name                       : proves.jpg_original
Directory                       : .
File Size                       : 71 kB
File Modification Date/Time     : 2006:10:02 16:37:04+02:00
File Type                       : JPEG
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Resolution Unit                 : inches
X Resolution                    : 72
Y Resolution                    : 72
Image Width                     : 600
Image Height                    : 404
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 1
Image Size                      : 600x404

Phil Harvey

The time zones in EXIF are stored separately.  If you want to save this as well, add this to the first command:

'-offsettimeoriginal<filemodifydate'

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

enboig