Author Topic: Script: Set file date/time from EXIF date/time  (Read 4112 times)

funkyaden

  • New Members
  • *
  • Posts: 3
Script: Set file date/time from EXIF date/time
« on: April 08, 2016, 12:52:21 AM »
IMatch 3.xx had a very simple but very useful script that did the task in the subject. This is incredibly useful because, usually twice a year, I forget to update the daylight savings time in at least one of my cameras. This is only really an issue when I then next go on a shoot with 2 cameras and forget to sychronise the clocks. I can easily update the EXIF times  - now even more simply than in iMatch 3.xx, thanks! But I used to also correct the file date/ time to match using the above script. I can't find any script in iMatch 5.xx to do the same thing - has anybody written one? I do this simply so listings in Windows Explorer remain the same relative to the two batches of files.

Sorry I didn't do any migration during the beta testing - work issues over the past few years have meant that passed me by, I'm afraid. So any help would be much appreciated.

Thanks.

Ger

  • Full Member
  • **
  • Posts: 246
Re: Script: Set file date/time from EXIF date/time
« Reply #1 on: April 08, 2016, 08:07:44 AM »
IMatch has a feature called metadata templates where you can easily copy information between various variables/metadata fields. I use this to perform such tasks.

Ger

funkyaden

  • New Members
  • *
  • Posts: 3
Re: Script: Set file date/time from EXIF date/time
« Reply #2 on: April 08, 2016, 02:36:40 PM »
Thanks Ger.  I'm not seeking to change the file metadata that can be changed with either this template or the options in the Tools menu.  I want to change the file modification time to be that same as the EXIF time.  I thought this could only be done via a script.  Or am I missing something?

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 27457
Re: Script: Set file date/time from EXIF date/time
« Reply #3 on: April 08, 2016, 07:13:17 PM »
Changing the file modification date has many severe and mostly unwanted side effects. It messes with your system backup, for instance. It may also confuse IMatch's 'file change' detection, among other things.

Settings the physical timestamp of a file from some EXIF data was sometimes required 10 years ago, when neither Windows nor other software was able to sort files by their EXIF timestamp. These days are long over. I strongly recommend that you review and update your workflow to current standards.

If you really, really need this, you can do it with ExifTool on the command line, or via the ExifTool Command Processor in IMatch. But I don't recommend this.

funkyaden

  • New Members
  • *
  • Posts: 3
Re: Script: Set file date/time from EXIF date/time
« Reply #4 on: April 09, 2016, 01:33:07 AM »
I see. Thanks for your advice. Not sure I've managed to get Windows to work so well for me yet.

PaulS

  • Full Member
  • **
  • Posts: 139
Re: Script: Set file date/time from EXIF date/time
« Reply #5 on: April 09, 2016, 02:24:14 AM »
As Mario stated, this can be done by using the ExifTool Command Processor.  See the commands below to change the Windows File Modify and Create Dates from EXIF Date Time Original.  I do this right after adding a file to the database and prior to backing them up.  I haven't had any issues with IMatch 5 doing this.  But of course your experience may be different.

-FileCreateDate<DateTimeOriginal
-FileModifyDate<DateTimeOriginal
{Files}

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 27457
Re: Script: Set file date/time from EXIF date/time
« Reply #6 on: April 09, 2016, 08:44:51 AM »
I see. Thanks for your advice. Not sure I've managed to get Windows to work so well for me yet.

Windows Explorer knows about (some) EXIF. By including the proper column you can show the EXIF timestamp and also sort by it. See the Windows help or various other sources on the Internet for more information.

In Windows Explorer, switch to the detailed view and then right-click into the header to open the menu which allows you to customize which data to show:



[attachment deleted by admin]

Rhadamanthys

  • Jr. Member
  • *
  • Posts: 52
Re: Script: Set file date/time from EXIF date/time
« Reply #7 on: April 11, 2016, 09:20:43 PM »
I agree with Mario. It is important to understand that Windows maintains all dates in UTC (Coordinated Universal Time, commonly referred to as Greenwich Mean Time, GMT). To the user, however dates are presented in the user's local time zone which may include a daylight saving time offset.
That is, your new year midnight picture shows a last modified date 2016-01-01 00:00:00 when reviewed in Winter and 2016-01-01 01:00:00 when reviewed in summer on your PC.
A similar picture taken by your friend living 6 hours west of you shows the same on his PC. But when he emails it to you it gets time stamped when you save it to disk. And if he is clever to zip it before emailing the unzipped picture shows a last modified date 2016-01-01 06:00:00 when reviewed in Winter and 2016-01-01 07:00:00 when reviewed in summer on your PC.

And if you assume the create date means the date when the file was originally created: Copy an old file into any other folder to learn its create date is now!

If you still want to fiddle around with Windows dates and time you may consider the subroutines contained in the attachment. I use them occasionally.

Being tired of all this mess all my camera clocks run on UTC so I know what the Exif date is about. After indexing in IMatch I calculate clock correction based on radio clock reference pictures and apply time zone info manually

[attachment deleted by admin]

Ooteboe

  • Jr. Member
  • *
  • Posts: 54
Re: Script: Set file date/time from EXIF date/time
« Reply #8 on: February 03, 2017, 04:20:09 PM »
Something similar here. Due to synchronizing from server tot server, the date created always changes to the date of synchronization. Some files (audio FLAC) don't have the proper tags to overcome that.  Now I want to make a xmp-sidecar with the date created set to date modified. Is there a way to do this automatically for several audio-files? A meta-template or something?

Thanks, Hans

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 27457
Re: Script: Set file date/time from EXIF date/time
« Reply #9 on: February 03, 2017, 06:10:50 PM »
A Metadata Template should to the trick just fine.

Ooteboe

  • Jr. Member
  • *
  • Posts: 54
Re: Script: Set file date/time from EXIF date/time
« Reply #10 on: February 03, 2017, 10:05:10 PM »
But with what code? I tried the tag XMP::xmp\CreateDate with the code: {File.Modified}. For a moment then I can see the right create-date in the metadate panel (with lies in the past), but within a few seconds it changes back to the present day. When I look in the sidecar I can see <xmp:CreateDate>2002-00-00T00:00</xmp:CreateDate>, the modified date is 2002-11-01. Unfortunately, I can't change the XMP with a editor.

Thanks,

Hans

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 27457
Re: Script: Set file date/time from EXIF date/time
« Reply #11 on: February 04, 2017, 08:16:29 AM »
When you set a metadata data manually (or from some other variable) you have to make sure that you create the proper date and time format.

ExifTool requires timestamps to be formatted as YYYY-MM-DD HH:MM:SS format. You need to format your source variable to use this format (see the variables help topic for more info).