ExifTool Forum

ExifTool => Newbies => Topic started by: glez on October 07, 2021, 03:12:08 PM

Title: Change Date Taken to Modification Date
Post by: glez on October 07, 2021, 03:12:08 PM
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.
Title: Re: Change Date Taken to Modification Date
Post by: StarGeek on October 07, 2021, 07:13:23 PM
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.
Title: Re: Change Date Taken to Modification Date
Post by: Alan Clifford on October 08, 2021, 09:12:21 AM
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.

Title: Re: Change Date Taken to Modification Date
Post by: glez on October 08, 2021, 10:00:48 AM
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    <<<<<                                                                                                                                                                                                                         
Title: Re: Change Date Taken to Modification Date
Post by: glez on October 08, 2021, 10:13:34 AM
@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
Title: Re: Change Date Taken to Modification Date
Post by: StarGeek on October 08, 2021, 10:43:21 AM
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.
Title: Re: Change Date Taken to Modification Date
Post by: glez on October 08, 2021, 11:32:27 AM
Agree.  However, the iPhone doesn't use the DateTimeOriginal but uses the FileCreateDate.   I Found this thread https://discussions.apple.com/thread/251149116 (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
Title: Re: Change Date Taken to Modification Date
Post by: glez on October 08, 2021, 03:36:54 PM
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"

)
Title: Re: Change Date Taken to Modification Date
Post by: glez on October 08, 2021, 04:30:13 PM
I was able to fix the videos by using the CreateDate of [QuickTime].


exiftool "-FileCreateDate<CreateDate" file_name
Title: Re: Change Date Taken to Modification Date
Post by: Phil707 on November 12, 2022, 01:41:06 PM
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.
Title: Re: Change Date Taken to Modification Date
Post by: wywh on November 12, 2022, 02:09:36 PM
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
Title: Re: Change Date Taken to Modification Date
Post by: StarGeek on November 12, 2022, 03:14:06 PM
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.
Title: Re: Change Date Taken to Modification Date
Post by: Phil707 on November 13, 2022, 06:33:27 AM
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
Title: Re: Change Date Taken to Modification Date
Post by: Phil Harvey on November 13, 2022, 07:13:42 AM
You need a space before the file name.

- Phil
Title: Re: Change Date Taken to Modification Date
Post by: Phil707 on November 14, 2022, 03:44:37 AM
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