Author Topic: Set exif DateTimeOriginal based on file names  (Read 212 times)

hscheele

  • New Members
  • *
  • Posts: 7
Set exif DateTimeOriginal based on file names
« on: June 17, 2022, 10:46:26 AM »
Hi all,

Just searching an easy way to sync Exif value 'DateTimeOriginal' depending on file name:

Filename - 2012-11-04__11.58.50.286.jpg
DateTimeOriginal - 4501:01:01 00:00:00

Is there a easy way to do so without doing this manually file by file? Already checked that I can take file name withing "Time Wiz" but in this case the file name needs to be splitted / converted to be used.

Thanks a lot!

// Hartmut

thrinn

  • Super Hero
  • ****
  • Posts: 1111
Re: Set exif DateTimeOriginal based on file names
« Reply #1 on: June 17, 2022, 02:21:44 PM »
Yes, this is easy to do with a Metadata Template. Create a template with your desired tag(s) as target and use something like
Code: [Select]
{File.Name|substr:0,4}:{File.Name|substr:5,2}:{File.Name|substr:8,2} {File.Name|substr:12,2}:{File.Name|substr:15,2}:{File.Name|substr:18,2}for the "Fill the tag from this data" part. Then you can simply select any number of files, execute the Metadata Template on them, and you are done.

You should check the expression above first in the Vartoy App to be sure that all indices etc. are correct.
Thorsten
Win 10 / 64, IMatch 2018, IMA

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 31554
Re: Set exif DateTimeOriginal based on file names
« Reply #2 on: June 17, 2022, 02:37:14 PM »
@hscheele: Since your post  count is low, I provide some additional pointers to tools and features that may help you with this:

Metadata Templates are a powerful tool to automatically add, modify and remove metadata, categories and collections, by user action or automatically when files are added to IMatch or are updated externally.

The same variable should also be usable in the Time Wiz (specialized on working with time) and the Metadata Mechanic, an all-purpose tool for dealing with metadata issues or all sorts and batch updates.

As noted by thrinn, the VarToy App allows you to create and test variables.
If you copy & paste the variable thrinn has provided above, you can see which date & time it produces for your files. If you are satisfied, you can use the variable in a metadata template (if you need it often) or just once in the TimeWiz, if you only need to correct some files.

Tip: Usually users do it the other way.
They rename files based on the EXIF/XMP timestamp to include the date and time in the file name. You can do that easily in IMatch with the Renamer.
« Last Edit: June 17, 2022, 11:57:45 PM by Mario »

wolboe

  • Full Member
  • **
  • Posts: 153
Re: Set exif DateTimeOriginal based on file names
« Reply #3 on: June 17, 2022, 11:41:36 PM »
Mein Weg ist ähnlich, mit trim:alpha entferne ich aber zuerst alles, was keine Ziffer ist, erst danach wird die Position der Ziffern zur Bildung der Datums- und Zeitwerte von links nach rechts verwendet

My way is similar, but with trim:alpha I first remove everything that is not a digit, only then is the position of the digits used to form the date and time values from left to right

Code: [Select]
{File.Name|trim:alpha;substr:0,4}:{File.Name|trim:alpha;substr:4,2}:{File.Name|trim:alpha;substr:6,2} {File.Name|trim:alpha;substr:8,2}:{File.Name|trim:alpha;substr:10,2}:{File.Name|trim:alpha;substr:12,2}
Wolfgang

hscheele

  • New Members
  • *
  • Posts: 7
Re: Set exif DateTimeOriginal based on file names
« Reply #4 on: June 18, 2022, 07:40:56 PM »
Hi all,

Thanks a lot for all your quick replys. It works after I followed (and adopted) your examples.

Hartmut