ExifTool Forum

ExifTool => Newbies => Topic started by: jamie12345 on April 27, 2023, 01:45:50 PM

Title: Used Exifdata, but the name + date is wrong
Post by: jamie12345 on April 27, 2023, 01:45:50 PM
Hi all,

Sorry if this is a basic question. I used the tool, using the following code in Terminal:

exiftool -r -d %s -tagsfromfile "%d/%F.json" "-GPSAltitude<GeoDataAltitude" "-GPSLatitude<GeoDataLatitude" "-GPSLatitudeRef<GeoDataLatitude" "-GPSLongitude<GeoDataLongitude" "-GPSLongitudeRef<GeoDataLongitude" "-Keywords<Tags" "-Subject<Tags" "-Caption-Abstract<Description" "-ImageDescription<Description" "-DateTimeOriginal<PhotoTakenTimeTimestamp" -ext "*" -overwrite_original -progress --ext json <DirToProcess>
It successfully restored all meta data - location, camera settings, etc, but the date (modified and created) shows as today, when I processed the image, and the name of the image is the date. I will attach a screenshot.

Does anyone know how to fix this? I'm very much a newbie with using terminal, so sorry if I've missed something obvious.



Title: Re: Used Exifdata, but the name + date is wrong
Post by: Phil Harvey on April 27, 2023, 01:48:18 PM
It sounds like you want to also update FileModifyDate and FileCreateDate.  Try adding this to your command:

"-filemodifydate<PhotoTakenTimeTimestamp" "-filecreatedate<PhotoTakenTimeTimestamp"

- Phil
Title: Re: Used Exifdata, but the name + date is wrong
Post by: jamie12345 on April 27, 2023, 01:50:33 PM
Thank you for the swift response, Phil.

Sorry - do you mean run this code as a new Terminal prompt? Or I add it... where exactly? Sorry this is the first time I've ever used Terminal so I'm doing my best to get to grips with it.

Thank you,
Title: Re: Used Exifdata, but the name + date is wrong
Post by: Phil Harvey on April 27, 2023, 01:55:48 PM
You can add these to your command anywhere after -tagsfromfile "%d/%F.json"

Or you can run a separate command to do this only, instead of writing these with the other tags:

exiftool -r -d %s -tagsfromfile "%d/%F.json" "-filemodifydate<PhotoTakenTimeTimestamp" "-filecreatedate<PhotoTakenTimeTimestamp" -ext "*" -overwrite_original -progress --ext json <DirToProcess>
- Phil
Title: Re: Used Exifdata, but the name + date is wrong
Post by: jamie12345 on April 27, 2023, 01:59:50 PM
Quote from: Phil Harvey on April 27, 2023, 01:55:48 PMYou can add these to your command anywhere after -tagsfromfile "%d/%F.json"

Or you can run a separate command to do this only, instead of writing these with the other tags:

exiftool -r -d %s -tagsfromfile "%d/%F.json" "-filemodifydate<PhotoTakenTimeTimestamp" "-filecreatedate<PhotoTakenTimeTimestamp" -ext "*" -overwrite_original -progress --ext json <DirToProcess>
- Phil

Hmm, I ran this code and in the terminal window I get a "Warning: error opening file" message.I just copied your code and replaced the file directory, as before.

Thanks,
Title: Re: Used Exifdata, but the name + date is wrong
Post by: Phil Harvey on April 27, 2023, 02:01:19 PM
Did the command you gave work?  If so, this should work too.  What was the file name in the error message?

- Phil
Title: Re: Used Exifdata, but the name + date is wrong
Post by: jamie12345 on April 27, 2023, 02:04:17 PM
Quote from: Phil Harvey on April 27, 2023, 02:01:19 PMDid the command you gave work?  If so, this should work too.  What was the file name in the error message?

- Phil

Yes, the original command I gave in my first message worked; it just didn't update the times or names.

I'm sorry,I don't know which file name you mean, but I have attached a screenshot of the error message, which appears.

Title: Re: Used Exifdata, but the name + date is wrong
Post by: Phil Harvey on April 27, 2023, 02:27:46 PM
I mean the file name on the line with the error.  The specified JSON file didn't exist.

That file wouldn't have existed for your original command either.  So you are doing something differently.  Did you move the JSON files?

- Phil
Title: Re: Used Exifdata, but the name + date is wrong
Post by: jamie12345 on April 27, 2023, 02:50:59 PM
Quote from: Phil Harvey on April 27, 2023, 02:27:46 PMI mean the file name on the line with the error.  The specified JSON file didn't exist.

That file wouldn't have existed for your original command either.  So you are doing something differently.  Did you move the JSON files?

- Phil

Hi, thanks again.

I did not do anything differently. I did, however, run a second command after the first one, which changed the image names - although I can't see what it was, I just found it online. I just checked, and all of the JSON files are still in the same folder; I have not touched them myself.

Should I just try again, and unzip the main file? If so, would you mind helping me with the proper way of doing it, so that the name is also restored with the meta data, and the correct dates.

Thank you so much for your help, I really do appreciate it a lot.
Title: Re: Used Exifdata, but the name + date is wrong
Post by: Phil Harvey on April 27, 2023, 02:57:20 PM
That would do it.

OK then, we can deal with that.

Run this command on the updated files (you don't need the JSON files because you have already set DateTimeOriginal from them).

exiftool "-filemodifydate<datetimeoriginal" "-filecreatedate<datetimeoriginal" -ext "*" --ext json -r DIR

- Phil
Title: Re: Used Exifdata, but the name + date is wrong
Post by: jamie12345 on April 27, 2023, 03:05:12 PM
Quote from: Phil Harvey on April 27, 2023, 02:57:20 PMThat would do it.

OK then, we can deal with that.

Run this command on the updated files (you don't need the JSON files because you have already set DateTimeOriginal from them).

Thank you, it prompted me to install "Developer Tools", and was showing error messages after I entered your code, so I quit the terminal window, will wait for the dev tools to install - it says about an hour. Thanks again for all your help

exiftool "-filemodifydate<datetimeoriginal" "-filecreatedate<datetimeoriginal" -ext "*" --ext json -r DIR

- Phil
Title: Re: Used Exifdata, but the name + date is wrong
Post by: Phil Harvey on April 27, 2023, 03:27:45 PM
I didn't know you were on Mac.

You don't need to install anything else if you modify the command to just set the FileModifyDate and not FileCreateDate.

But how are you installing the dev tools?  I didn't think it should take that long.  You can use this command to install them:

xcode-select --install

- Phil
Title: Re: Used Exifdata, but the name + date is wrong
Post by: jamie12345 on April 27, 2023, 03:46:56 PM
Ah, yes sorry I'm on Mac lol. It's OK, I installed the dev tools it prompted me too, and out of 700 images, about 685 are perfect :) A few changed the date to the 1600s weirdly, but I can manually work through all of them.

The Dev tools message popped up automatically when I input your last code you gave me. Now is the real test, and to do 3,000 images and MP4s :)

Thank you for your help again
Title: Re: Used Exifdata, but the name + date is wrong
Post by: Phil Harvey on April 27, 2023, 03:48:40 PM
If you are doing MP4's, you should change DateTimeOriginal to CreateDate in your commands because the MP4 format doesn't use DateTimeOriginal.

- Phil
Title: Re: Used Exifdata, but the name + date is wrong
Post by: jamie12345 on April 27, 2023, 04:04:35 PM
Once again, thank you so much! I very much appreciate your help