Change Date Taken to Modification Date

Started by glez, October 07, 2021, 03:12:08 PM

Previous topic - Next topic

glez

Hi, I just started using ExifTool and have a question regarding how to change the Create Date to match the Modification Date.

I've been backing up the photos from my Android phone to a local folder on my laptop and am trying to restore them to a new iPhone.  I noticed the phone is using the file date to collate them by year, month, day, etc.  This date turns out to be when I copied the images to the PC (create date on the PC).  Details of the photos show the modify date is still intact in the local folder and the metadata on the old Android phone is accurate.

Is it possible for ExifTool to change the Create date to the Modify date?  If so and example would be appreciated.

StarGeek

The best thing to do is run this command on the file
exiftool -time:all -G -a -s file.jpg

This will show you all the time related tags for the file.

I'm guessing that your command would be
exiftool "-FileCreateDate<FileModifyDate" /path/to/files/
but you'll have to look at the output of the above command to make sure.  If the tags you actually want to use have a different name, use those instead.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Alan Clifford

QuoteIs it possible for ExifTool to change the Create date to the Modify date?

I'm wondering if this is the right question as you have suggested a solution which might not be the best.  As you have found out, the file system dates are not stable so it might be better to use "datetimeoriginal" if the exif data exists in the photos.


glez

Thanks for the help.  It looks like only the mod date is available but the command line does work.  I'll have to sync iTunes to see if the phone picks it up.

One thing I noticed is that if I run the command then copy the file the create date is set back to now.  So this has to be done in place; in the sync folder so the create date sticks.


exiftool -time:all -G -a -s img956279.jpg
[File]          FileModifyDate                  : 2020:11:16 18:31:36-05:00  <<<<<
[File]          FileAccessDate                  : 2021:10:08 02:37:19-04:00
[File]          FileCreateDate                  : 2021:10:07 14:55:25-04:00

exiftool "-FileCreateDate<FileModifyDate" img956279.jpg
1 image files updated                                                                                                                                                                                                                                                                                                                                                                                                                         

exiftool -time:all -G -a -s img956279.jpg
[File]          FileModifyDate                  : 2020:11:16 18:31:36-05:00
[File]          FileAccessDate                  : 2021:10:08 09:57:37-04:00
[File]          FileCreateDate                  : 2020:11:16 18:31:36-05:00    <<<<<                                                                                                                                                                                                                         

glez

@Alan Clifford - The  "datetimeoriginal" is not there but I was able to create it.  I hope this works.

exiftool "-DateTimeOriginal<FileModifyDate" img956279.jpg
    1 image files updated

exiftool -time:all -G -a -s img956279.jpg
[File]          FileModifyDate                  : 2021:10:08 10:11:20-04:00
[File]          FileAccessDate                  : 2021:10:08 10:11:21-04:00
[File]          FileCreateDate                  : 2020:11:16 18:31:36-05:00
[EXIF]          DateTimeOriginal                : 2020:11:16 18:31:36

StarGeek

The DateTimeOriginal tag should work for a jpg.

The difference is that the File tags are part of the underlying operating system and do not necessarily copy over when moving the file.  The DateTimeOriginal is actually embedded in the file and won't change by just copying the file.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

glez

Agree.  However, the iPhone doesn't use the DateTimeOriginal but uses the FileCreateDate.   I Found this thread https://discussions.apple.com/thread/251149116 that has good info.

So I set the FileCreateDate to the FileModDate, synced with iTunes and it worked perfectly.  The only thing that concerns me is that all the file dates are now set to the mod date.  I don't know how the access date got changed.

exiftool "-FileModifyDate<FileCreateDate" "img956279.jpg"
    1 image files updated

exiftool -time:all -G -a -s "img956279.jpg"
[File]          FileModifyDate                  : 2020:11:16 18:31:36-05:00
[File]          FileAccessDate                  : 2020:11:16 18:31:36-05:00
[File]          FileCreateDate                  : 2020:11:16 18:31:36-05:00
[EXIF]          DateTimeOriginal                : 2020:11:16 18:31:36

glez

Awesome tool.  In the end this worked like a charm!  Some photos have data problems but not many and it doesn't seem to work on videos.  In the end I created a cmd script to fix all the photos in a folder, (add /r to the for command to make it recursive). 

doall.cmd:


@echo off

for %%i in ("folder_path\*") do (

exiftool -overwrite_original "-EXIF:DateTimeOriginal<FileModifyDate" "%%i"

exiftool "-FileCreateDate<EXIF:DateTimeOriginal" "%%i"

exiftool "-FileModifyDate<EXIF:DateTimeOriginal" "%%i"

)

glez

I was able to fix the videos by using the CreateDate of [QuickTime].


exiftool "-FileCreateDate<CreateDate" file_name

Phil707

#9
I have the same problem. Could solve it though with the command mentioned.

Just with this file it won't work:

xxx@MacPro ~ % exiftool '-FileCreateDate<FileModifyDate'
/Volumes/SSD\ Raid/PHOTOS\ SSD/__XXX/ICH/Mix/1970-01-01_01-00-00\ \(2\).jpg
No file specified
zsh: permission denied: /Volumes/SSD Raid/PHOTOS SSD/__XXX/ICH/Mix/1970-01-01_01-00-00 (2).jpg

It's not a big deal....but I'd be curious why the file denies permission here.

wywh

If you are a Mac user:

Use 'ExifIFD:DateTimeOriginal' for image dates.

Use 'QuickTime:CreateDate' with exiftool '-api QuickTimeUTC=1' option for movies after 1970 and also 'Keys:CreationDate' for older movies.

Check all relevant dates:

exiftool -a -G1 -s -api QuickTimeUTC=1 -Time:All -api RequestAll=2 .

https://discussions.apple.com/docs/DOC-250002750

- Matti

StarGeek

Quote from: Phil707 on November 12, 2022, 01:41:06 PMxxx@MacPro ~ % exiftool '-FileCreateDate<FileModifyDate'
/Volumes/SSD\ Raid/PHOTOS\ SSD/__XXX/ICH/Mix/1970-01-01_01-00-00\ \(2\).jpg
No file specified
zsh: permission denied: /Volumes/SSD Raid/PHOTOS SSD/__XXX/ICH/Mix/1970-01-01_01-00-00 (2).jpg

It's not a big deal....but I'd be curious why the file denies permission here.

It seems to me that you have the command split across two separate lines.

First, you are running the exiftool command.  Just this part
exiftool '-FileCreateDate<FileModifyDate'

Exiftool is then returning No file specified because the file name isn't on this line.

Then you are running just the filepath
/Volumes/SSD\ Raid/PHOTOS\ SSD/__XXX/ICH/Mix/1970-01-01_01-00-00\ \(2\).jpg

The terminal then returns the permission error.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil707

Actually, I'm doing the same as with all the other commands - pasting the command and then dragging the file onto Terminal.

And with all other commands it works. So I can only conclude that there is something not wirking with this specific command...?

ABC@MacPro ~ % exiftool '-FileCreateDate<FileModifyDate'/Users/ABC/Desktop/test.JPG
No file specified

Phil Harvey

You need a space before the file name.

- 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 ($).

Phil707

Ahhh. Sorry, I#m such a beginner to this .

But I had managed to do the job with this command:

exiftool '-alldates<filecreatedate' -P
(the date created is now the date modified)
But yeah...there is a space hehe