ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: bl4ze on August 04, 2023, 06:31:59 PM

Title: Trying to set every date to the date at which a photo was taken
Post by: bl4ze on August 04, 2023, 06:31:59 PM
I tried
exiftool "-AllDates<DateTimeOriginal" <image_file>
and it returns 1 image files updated but the values stay the same when checking up on them again, I specifically want the CreationDate to be set to the Date at which the photo was taken but I would like best to have all dates set to it.
Title: Re: Trying to set every date to the date at which a photo was taken
Post by: StarGeek on August 04, 2023, 06:53:22 PM
See the notes under AllDates on the  Shortcuts tags page (https://exiftool.org/TagNames/Shortcuts.html)

AllDates is a shortcut only to the three most common EXIF timestamps, CreateDate, DateTimeOriginal, and ModifyDate.  It does not edit any other tag.

To write CreationDate, you would use
exiftool "-CreationDate<DateTimeOriginal" /path/to/files/

There is Time:all, but you almost never want to write to that, as it will write to about 90 tags in total in an image file, many of which will not be applicable.

A more targeted approach would use the -wm (-writeMode) option (https://exiftool.org/exiftool_pod.html#wm-MODE--writeMode), specifically -wm cg.  This command would update all date/time tags that already exist in the file, but it will not create any new ones
exiftool -wm cg "-Time:All<DateTimeOriginal" /path/to/files/
Title: Re: Trying to set every date to the date at which a photo was taken
Post by: bl4ze on August 05, 2023, 06:41:20 AM
Thank you so much for your help!
However, I tried using
exiftool "-CreationDate<DateTimeOriginal" /path/to/files/which again in return gave me 1 image files updated but it didn't actually change the date created on the file that I changed. Then I tried using
exiftool -wm cg "-Time:All<DateTimeOriginal" /path/to/files/But all that did is returning
0 image files updated
1 image files unchanged
without any error whatsoever. What am I doing wrong?
Title: Re: Trying to set every date to the date at which a photo was taken
Post by: Phil Harvey on August 05, 2023, 05:27:21 PM
The problem is usually that you are writing the wrong date/time tag.

Quote from: bl4ze on August 05, 2023, 06:41:20 AMbut it didn't actually change the date created on the file that I changed.

ExifTool did change the date if it said the file was updated.  Why do you say it didn't change?

Use this command to see all date/time tags in the file:

exiftool -a -G1 -s FILE

And be sure you are writing the correct one.

- Phil