Batch-process to change date/time back to DateTaken EXIF MTP

English support forum

Moderators: white, Hacker, petermad, Stefan2

User avatar
Hacker
Moderator
Moderator
Posts: 13064
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Phred,
does anyone know of a way to find files where writedate and dateoriginal differ
This short AHK script checks the current dir and all its subdirs for such files and lists them in DifferingTimesFileList.txt.

Code: Select all

Loop, Files, *.*, R
	IfNotEqual, A_LoopFileTimeModified, %A_LoopFileTimeCreated%
		FileList = %FileList%%A_LoopFileName%`n

StringTrimRight, FileList, FileList, 1

IfNotExist, DifferingTimesFileList.txt
	FileAppend, %FileList%, DifferingTimesFileList.txt
HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
Phred
Senior Member
Senior Member
Posts: 375
Joined: 2009-06-16, 15:24 UTC
Location: SEAu

Nice Code

Post by *Phred »

That looks excellent, Hacker/R, but the only thing is that the dateoriginal that I'm looking for is an Exif parameter, whereas the creationdate (that's in LoopFileTimeCreated% - yes?) is a file-system one, I believe.

I use the Exif plug-in to read the data inside photos and compare that with archived files' T/Ds, that will likely never change again. I know T/DModified is fluid but it's easier to see via inspection than constantly having Exif T/D read.

You don't know if AHK can read Exif data, do you?

Thx.
User avatar
Hacker
Moderator
Moderator
Posts: 13064
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Phred,
Ah, I apologize. You will need ExifTool.

Code: Select all

exiftool.exe -r -progress "-FileModifyDate<DateTimeOriginal" -d %Y%m%d%H%M%S -if "$FileModifyDate ne $DateTimeOriginal" .
The command adjusts the timestamp of all image files in the current dir and its subdirs if they differ from their respective Exif DateTimeOriginal values, ignoring any timezone information.
To disable recursion, remove the -r switch.
To process only eg. JPG files, replace the period . at the end with *.jpg.

HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
Phred
Senior Member
Senior Member
Posts: 375
Joined: 2009-06-16, 15:24 UTC
Location: SEAu

Thanks, ASFIG

Post by *Phred »

Thanks, HackeR.
The date comparison I'm after is really a quick operation - a search/a click on a control - that lets me inspect files with differing dates, and then decide what to do with them.

Your AHK goes further and changes dates themselves; I should acquaint myself further with AHK and intercept your code so that it produces a list as you did earlier, but, in the meantime, I expect I should just 'change' the dates on all few hundred files with TC's Attributes control, reading the Exif dates from a plug-in and proceeding (some dates wouldn't need to change, but would be 'changed' anyway).

Date attributes can be changed with certain expressions, e.g.s only: [=tc.fullname:9-10]/[=exif.dateoriginal] - as I expect you know.

Thx.
Regards, PhredE
Licence holder since 1999
Awaiting a $D donors-token for the title-bar so we can display that we have donated further.
User avatar
Hacker
Moderator
Moderator
Posts: 13064
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Phred,
This is actually not AHK, just the ExifTool program.
My main point was that actually changing all the dates would be much faster than checking which ones need to be changed and change only those.
Of course, a simple script can be written to create a list of files where the EXIF and file dates differ.

Or please correct me if I misunderstood your goal (again).

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Post Reply