writing date and time based on filename

Started by gheppell, May 15, 2020, 01:46:20 AM

Previous topic - Next topic

gheppell

Hello. 

I name all of my photo and video files according to the following format:

Jan 06, 2008@12.59.52.jpg

I am trying to find a tool and/or means within imatch that allows me to grab the date/time components from the filename and then apply them to pretty much every date/time tag. 

Further, for any given set of files that I alter in this way, I would like to define the timezone, such that date/time files that accept timezones are populated with it.  Using the above example, xmp:createdate would be populated as follows:

2008:01:06 12:59:52 PM-07:00  {or whatever time zone is set, perhaps with a variable(?), since not all files will have the same time zone)

Template perhaps?  I can do most of this using the exiftool command processor and having to run it a few times, but can't quite figure out how to extract the info using imatch.

Thanks.

Ger

A metadata template would do the trick, I think.
You can update multiple date fields in one template.

Mario

#2
Extracting the date and time from file names is simple wit a variable is simple, in principle.
Because most of the time, when users store date and time in a file name, they use the standard format YYYY-MM-DD or YYYY_MM_DD or YYYYMMDD... and HHMMSS or HH_MM_SS for the time.
This makes it pretty straightforward to extract the individual date and time components from the {File.Name} variable with substr.

Setting a date and time metadata tag requires a date and time in the standard ISO format YYYY:MM:DD HH:MM:SS. 24 hour format!
This is what you need to produce from the source variable(s). Example: 2020:05:14 12:11:10

For example, for the file name 2020-04-17 17-01-53.ext the year can be extracted with {File.Name|substr:0,4}, the month with {File.Name|substr:5,2} and so on.

But looking at your file names, it seems you have actually used abbreviated month names: Jan 06, 2008@12.59.52.jpg which not only requires extracting segments of your file names with variables, but also mapping texts like "Jan" to "01" to make this work. This is doable, but will require to write complex variables with many replace statements: replace:Jan==01;replace:Feb==02 and so on.

Furthermore, your file names contain time zones, AM/PM indicators. This is ridiculous. Which kind of app created such strange file names?
This makes everything super hard. And these file names are not even properly sortable by date and time, which would require the Year, Month, Day to be in that order.

This should still be doable. But will require a ton of variables and replacements and stuff to transform these weird file names into something usable. I mean, honestly, 12 hour format and AM/PM indicators in file names...?

Create your variable in the VarToy app in IMatch and test it thorough before you use it in a Metadata Template or the TimeWiz app.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook