Date Calculation on IF condition

Started by grumpy, August 02, 2014, 12:38:27 AM

Previous topic - Next topic

grumpy

Hi

Is it possible to test for the condition if two date values are X hours different in the -IF tag?

I want to apply changes only to files that have are more than 8 hours difference in the "trackCreateDate" and "FileModifyDate".

@roscoe:~ ! exiftool ~/Desktop/185.MP4 -trackcreatedate -filemodifydate -ext mp4 -ext mov -ext avi -if '($filemodifydate-$trackcreatedate) gt 8'

Thanks!

Phil Harvey

Sorry for the delay in responding.  I've been on vacation.

I can think of no simple way to do this.  Doing math with date/time values would take at least a few lines of code, which would make for a very messy advanced formatting expression that would look like this:

exiftool -if '${filemodifydate;my @a=split /[: ]/;$a[0]-=1900;$a[1]-=1;use Time::Local;$_=Time::Local::timelocal(reverse @a)} - ${trackcreatedate;my @a=split /[: ]/;$a[0]-=1900;$a[1]-=1;use Time::Local;$_=Time::Local::timelocal(reverse @a)} > 8 * 3600' ...

- 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 ($).