I am a photographer part of my work flow is to go through all my downloaded images and look for gaps in the created date. This is to ensure I downloaded all my memory cards. I am trying to automate this by script and found ExifTool the easiest way to view the created dated and need to go a little further. I hope someone can help me on here.
Basically I want to compare each file to see if the created date is more than 5 minutes older than then the following image. I would then output the images with those differences so that I can manually confirm the gap is expected.
Thanks for any help I can get. 8)
I would suggest something like this:
exiftool -createdate -directory -filename -T -r DIR | sort > out.txt
Then import the tab-delimited text file in your favourite spreadsheet and take a difference of the successive dates to look for the time gaps.
Notice I piped the exiftool output through "sort" so that the times will be sequential in the output txt file.
- Phil
Quote from: Phil Harvey on June 07, 2015, 04:11:34 PM
Notice I piped the exiftool output through "sort" so that the times will be sequential in the output txt file.
Would adding
-fileorder Createdate not work here?
For what it's worth, I wanted to see if I could create a user defined tag to figure this out. I came up with something that almost works
use Time::Local;
$PreviousTimestamp='';
#------------------------------------------------------------------------------
# User-defined tag definitions
#
%Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => {
SecondsAfterPrevious => {
Require => 'CreateDate',
ValueConv => sub{
my $val = shift;
my ($year,$mon,$mday,$hour,$min,$sec) = split(/[\s.:]+/, $$val[0]);
my $CurTime = timelocal($sec,$min,$hour,$mday,$mon-1,$year);
if ($PreviousTimestamp eq '')
{
$PreviousTimestamp = $CurTime;
return 0;
}
$diff = $CurTime - $PreviousTimestamp;
$PreviousTimestamp = $CurTime;
return ($diff);
},
},
},
);
#------------------------------------------------------------------------------
1; #end
I was thinking that you could use something like
ExifTool -config This.Config -if "$SecondsAfterPrevious>=300" -fileorder CreateDate -SecondsAfterPrevious DIR
to get a list of files to check. Only trouble, if the IF condition isn't fulfilled, then the file isn't processed and the $PreviousTimestamp variable isn't set.
It could be changed and just hardcode the 5 minute difference check, outputting a true or false, but I think Phil has the quicker/easier route.
And without the -fileorder option, it may just output completely useless data.
Quote from: StarGeek on June 07, 2015, 05:19:15 PM
Quote from: Phil Harvey on June 07, 2015, 04:11:34 PM
Notice I piped the exiftool output through "sort" so that the times will be sequential in the output txt file.
Would adding -fileorder Createdate not work here?
Yes it would, but it requires an additional ExifTool pass which would be less efficient than just "sort"-ing afterwards.
Interesting idea with the user-defined tag.
- Phil
Thanks for the help gentlemen. I have tried both solutions and they do accomplish what I was asking for. I was hoping to have this process completely automated but it appears this is a little more difficult than I thought.