Used Exifdata, but the name + date is wrong

Started by jamie12345, April 27, 2023, 01:45:50 PM

Previous topic - Next topic

jamie12345

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.




Phil Harvey

It sounds like you want to also update FileModifyDate and FileCreateDate.  Try adding this to your command:

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

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

jamie12345

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,

Phil Harvey

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

jamie12345

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,

Phil Harvey

Did the command you gave work?  If so, this should work too.  What was the file name in the error message?

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

jamie12345

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.


Phil Harvey

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

jamie12345

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.

Phil Harvey

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

jamie12345

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

Phil Harvey

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

jamie12345

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

Phil Harvey

If you are doing MP4's, you should change DateTimeOriginal to CreateDate in your commands because the MP4 format doesn't use DateTimeOriginal.

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

jamie12345

Once again, thank you so much! I very much appreciate your help