Set datetimeoriginal of one set of photos from filemodifydate of another

Started by jbarnes, July 29, 2018, 09:51:52 PM

Previous topic - Next topic

jbarnes

If this has been covered previously, please let me know.

I have discovered that half of the cameras I have deployed do not record a Date/Time Original stamp. I am no faced with a problem in that I have started tagging some of these photos and in doing so the file modification date/time has changed. Previously I was using exiftool to add a Date/Time Original stamp based on the original File Modification Date/Time. Unfortunately, now, if I try to do that with these tagged photos, it give me the new modification date instead, so I can't update the Date/Time Original to what it should be.

So, before you ask, yes, I have the original raw files that have not been altered in any way, and these DO contain the original File Modification Date/Time stamp that I need to update the Date/Time Original in the EXIF data. So, I need to know if one of the following three things is possible:

1) is there a way of looking at previous versions, or previous file modification dates by which I would then be able to update the Date/Time Original
2) can I set the Date/Time Original of one set of photos (namely, my tagged photos with an updated modification date/time), based on the File Modification Date/Time of another set of photos (namely my raw, untagged files)
3) or, and this may be beyond the scope of this group, is there a way to copy over metadata tags from one set of photos (namely, my tagged photos), to another set (namely, a second copy of my raw, untagged files)

Thanks for any assistance

jbarnes

I should add that I can get the following command to function, and I am aware of it:

exiftool -tagsfromfile "C:/filepath/1.JPG" -filemodifydate "C:/filepath/2.JPG"

What I would like to be able to do is expand this to work on a batch system by folder so that I don't have to do the above for ~30,000 photos.
Any modifications of this I have so far tried haven't worked, unfortunately.

PS: I realise the above serves only to copy over the File Modify Date and I would still have to then run more code to set that as the Date/Time Original, but I'd still rather do that than every single photo, one by one.

StarGeek

Quote from: jbarnes on July 29, 2018, 09:51:52 PMI have started tagging some of these photos and in doing so the file modification date/time has changed.

Add the -P option to your command to avoid this.

Quote1) is there a way of looking at previous versions, or previous file modification dates by which I would then be able to update the Date/Time Original

No, once FileModifyDate (or either of the other two File*Date) has been changed, there's no previous record of it.

Quote2) can I set the Date/Time Original of one set of photos (namely, my tagged photos with an updated modification date/time), based on the File Modification Date/Time of another set of photos (namely my raw, untagged files)

As you show in your second post, yes you can.

Quote from: jbarnes on July 29, 2018, 10:39:17 PM
What I would like to be able to do is expand this to work on a batch system by folder so that I don't have to do the above for ~30,000 photos.
Any modifications of this I have so far tried haven't worked, unfortunately.

Can you give a real example?  It's seems unlikely that you named the original 1.jpg and the corresponding processed file 2.jpg.  If there is a pattern, or hopefully, the same name, just different directories/extensions, then it's easy.  It most likely be some variation of the example exiftool -tagsfromfile %d%f.CR2 -r -ext JPG dir from Copying Examples.
* 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).

jbarnes

Thanks StarGeek. Yes, I'll be using -P from now on.

As for a real example:

exiftool -tagsfromfile "C:/Users/UserName/Desktop/exiftestingground/FolderB/IMAG0001.JPG" -filemodifydate "C:/Users/UserName/Desktop/exiftestingground/FolderA/IMAG0001.JPG"

All file and folder names are legit, it was just a test folder I set up so as not to screw with any raw data. When I tried doing this on a directory level rather than a file level (which I want/need to do based on the sheer volume of files), however, I get an error saying:

Warning: Error opening file - C:/Users/UserName/Desktop/exiftestingground/FolderA/

That's where I'm at.

jbarnes

In my testing folder I HAVE got the following code to work:

exiftool -tagsfromfile %d%f.JPG -filemodifydate "C:/Users/Jarrad Barnes/Desktop/exiftestingground/FolderA"

... as long as I have already navigated to the folder from which I want to copy, first. Is this the only way to do this, or can I enter that directory in the command line? It's not a big issue, more curiosity as I think I will be able to work it from this point. I'll return with hopefully good news.

Thanks.

jbarnes

Okay, so the above didn't work. That is, the process ran through exiftool as before, without any error messages, but the file modification date hasn't updated. Any thoughts?

jbarnes

So, for anyone who is also looking for an answer to this, this appears to work. Ensure you have a datetimeoriginal tag set in your EXIF data first, or it won't work.
There may be an easier way but this is what has finally clicked for me:

exiftool -tagsfromfile C:\SourceFolder\%f.JPG -datetimeoriginal "C:\DestinationFolder"