Finding CreateDate gaps in a folder

Started by Agustis, June 07, 2015, 01:21:01 PM

Previous topic - Next topic

Agustis

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)



Phil Harvey

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

StarGeek

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?
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

StarGeek

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.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

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

Agustis

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.