Transferring filename to date created

Started by Merel van Nieuwenhuijzen, November 16, 2020, 09:58:17 AM

Previous topic - Next topic

Merel van Nieuwenhuijzen

I'm really a newby at this, don't have a clue about how these things work and I'm sorry if the answer to my question is already somewhere on the forum, but I really tried (for hours) and cannot find it...

My situation:
It started with the fact that I 'only wanted' to have the media in a whatsapp group on my sisters phone on my laptop (they were accidentally erased from my own whatsapp). I will spare you all the things I have done over the last couple off days (spending a lot of time on the internet) to try and get them on my computer (or one drive) with the metadata concerning the date the picture was taken in the correct place, but it did not work. In the end I was advised (by a really kind person of the support team of an app I downloaded on my phone to extract the information from my phone to my onedrive) to download you app.

Being completely not familiar with this kind of 'technology' it took me several hours but I think I installed it correctly and now know kind of how this DOS stuff works and am able to open the window and type in a command. And was able to drag and drop a picture into the window and display the metadata. So I guess most of the work is done, and I 'simply' need to find the correct command to let it do what I want. But I cannot find it. So I hope you will be able to help me (and please if you answer me: treat me like someone wit almost no knowledge of this manner of 'programming'.

I have a folder with a lot of pictures on my computer (finally). The problem is that (due to whatsapp, Apple, ....?) I cannot get the date the pictures/video's were taken in the right place in the metadata.

My computer talks dutch to me, so I'm not sure if I'm using the correct translation, but if I have a look at the details of each picture there are the following dates/lines displayed (first Dutch and after my translation to English):
"Genomen op": should be the date the picture was taken
"Aanmaakdatum": not completely sure but it should translate as the date and time the file was created, I'm not sure how this is different from the "Genomen op" date. It displays a date and a time
"Gewijzigd op": date and time the file was last changed.

Now, this batch of pictures I managed to get the date the picture was made into date the file was changed. ("genomen op" does not contain any date and "Aanmaakdatum" contains (incorrectly) the date I downloaded the pictures of my phone. Problem is that when I edit the picture the date the file was changed is overwritten, and I loos the date the picture is taken, so that does not work.

See screenshot of what I managed to do (after 3 days....):
...
Ok, I don't seem to be able to figure out how to get an image in this posting, so I attached the screenshot as an attachment. Hope you can see it somewhere, now I really feel a dummy....

So I want either to have the filename (containing date and time the picture was taken) transferred to either "Genomen op" or "Aanmaakdatum" (I'm not sure about the diferrence), so that it wit stay in the metadata if I move or edit (and resave/rename) the picture.
Or the date and time at "Gewijzigd op" transferred to one of those dates.
Either option is fine to me.

Hope you can tell me (in easy to understand language....) how to get this done.

Phil Harvey

I don't have time to read your post, but reading just the title and looking at your attached image, I think you may want to do this:

exiftool "-alldates<filename" 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 ($).

StarGeek

Quote from: Merel van Nieuwenhuijzen on November 16, 2020, 09:58:17 AM
So I want either to have the filename (containing date and time the picture was taken) transferred to either "Genomen op" or "Aanmaakdatum" (I'm not sure about the diferrence), so that it wit stay in the metadata if I move or edit (and resave/rename) the picture.
Or the date and time at "Gewijzigd op" transferred to one of those dates.
Either option is fine to me.

Phil probably has the right answer but it would help to see the actual tag name output instead of the descriptions.  This would be FAQ #2.

Run this command on your test file.  It will show you the tag names, not descriptions, as well as showing duplicate tags and their locations.
exiftool -time:all -G1 -a -s /path/to/file/

You would then look over that output and try to match the time stamp to the Dutch name.  Once you figure out which tag is showing the wrong time, then would use alter Phil's command to reflect the new destination.  The AllDates used in Phil's command is a shortcut for these three tags: DateTimeOriginal, ModifyDate, and CreateDate.  So if the place you want to copy to is one of those, then you don't need to alter Phil's command.

Other possible tags you might look at to see if that's where you want to copy the data to are FileModifyDate and FileCreateDate.
* 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).

Merel van Nieuwenhuijzen

Thanx for the answers. I made the tool show the tagnames (for my own memory: C:\WINDOWS\system32>exiftool -time:all -G1 -a -s "C:\Users\vissc110\OneDrive - Universiteit Utrecht\XX testmap\iPhone van Merel\Welkom Jip app\2016-12-14_22-05-02.JPG")  and got this:
[System]        FileModifyDate                  : 2016:12:14 22:05:02+01:00
[System]        FileAccessDate                  : 2020:11:17 14:01:32+01:00
[System]        FileCreateDate                  : 2020:11:16 14:56:27+01:00
So I used the command Phil suggested on a test file and it worked!!!!
And then I dragged the entire folder with pictures into the screen and then it took quite a while but then it happened: it worked!!!!
At least: for all the pictures. For the video's it did not work. So I tried showing the tagnames command on a testvideo(thinking tagnames for video's would be different), but it responded with access denied.

Now the video's are less important to me, but I'm a perfectionist, so is there a way to make this also work for the video's (MP4)?

StarGeek

Quote from: Merel van Nieuwenhuijzen on November 17, 2020, 08:36:00 AMAt least: for all the pictures. For the video's it did not work. So I tried showing the tagnames command on a testvideo(thinking tagnames for video's would be different), but it responded with access denied.

The access denied would be from the file system.  It's usually a permissions or ownership issue.

For MP4/MOV video files, the same command would work sorta.  The timestamps in video files is supposed to be set to UTC for the CreateDate and ModifyDate tags.  So running the above command would set the timestamps so they would be off by the timezone.  As long as the files are in the same timezone that they were created, you can add -api QuickTimeUTC to the command and it will get adjusted.

One other possible problem is the DateTimeOriginal tag in video files, and that applies to Macs.  On a Mac, the DateTimeOriginal tag in a video must also have a time zone component, e.g. 2020:11:17 07:00:00-08:00 or Apple Photos will show a seriously incorrect date.



* 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).

Merel van Nieuwenhuijzen

The access denied message was my fault. I was not paying attention and made an error in copying and pasting the command.

So, with the video's I got:
C:\WINDOWS\system32>exiftool -time:all -G1 -a -s "C:\Users\vissc110\OneDrive - Universiteit Utrecht\XX testmap\iPhone van Merel\Welkom Jip app\2016-12-21_14-45-46.mp4"
[System]        FileModifyDate                  : 2020:11:17 14:25:16+01:00
[System]        FileAccessDate                  : 2020:11:17 16:21:53+01:00
[System]        FileCreateDate                  : 2020:11:16 14:56:26+01:00
[QuickTime]     CreateDate                      : 2016:12:21 14:45:46
[QuickTime]     ModifyDate                      : 2016:12:21 14:45:46
[Track1]        TrackCreateDate                 : 2020:11:14 13:35:46
[Track1]        TrackModifyDate                 : 2020:11:14 13:35:47
[Track1]        MediaCreateDate                 : 2020:11:14 13:35:46
[Track1]        MediaModifyDate                 : 2020:11:14 13:35:47
[Track2]        TrackCreateDate                 : 2020:11:14 13:35:46
[Track2]        TrackModifyDate                 : 2020:11:14 13:35:47
[Track2]        MediaCreateDate                 : 2020:11:14 13:35:46
[Track2]        MediaModifyDate                 : 2020:11:14 13:35:47
[UserData]      DateTimeOriginal                : 2016:12:21 14:45:46
[XMP-exif]      DateTimeOriginal                : 2016:12:21 14:45:46
[XMP-xmp]       CreateDate                      : 2016:12:21 14:45:46
[XMP-xmp]       ModifyDate                      : 2016:12:21 14:45:46

So I ran the command:
C:\WINDOWS\system32>exiftool "-FileCreateDate<filename" DIR

And that worked! So I did the folder containing all of the video's and it seems to be fixed.

I'm really greatfull for you help. Now after day's I can finally start sorting the pictures and video's and create a nice album as present to my sister!!! Thanx you all!