ExifTool Forum

ExifTool => Newbies => Topic started by: grog808 on January 23, 2014, 02:26:07 PM

Title: What to look for to determine if the file was actually from a camera
Post by: grog808 on January 23, 2014, 02:26:07 PM
Yes... I am a newbie...  I'm helping a friend try to recover her pics from a crashed hard drive (very crashed...)  Used Photorec and it found a ton of pics.  Most are probably cached stuff from web browsing.  She wants the pics that she took with her digital camera, iphone, etc. 

I'm trying to use ExifTool from a Perl script to discern what is a real photo.  I'm open to going the other way also... Maybe to look for what is NOT a photo (from her cam).  Modifying some examples I found online, i'm able to obtain Exif info from every file.  I'm suspecting that the junk from her web cache are the ones that just have the pixel dimensions and that's it.  Some files have what you would expect... lens info, did the flash fire, make of the camera, etc.

As a first pass, I just want to separate her pics from the cache.  Maybe moving them to a different directory., since I'm suspecting the vast majority is cache junk.

I thought I would try searching to see if "Make" was present, but apparently, I don't know how to tell.  Any Perl scripting wizards that could shed some light?
Title: Re: What to look for to determine if the file was actually from a camera
Post by: StarGeek on January 23, 2014, 03:57:02 PM
You don't need to make a perl script to separate out photos, ExifTool can do this by itself.  For example, to move any photo that has a Make tag

ExifTool -if "defined $Make" "-directory</path/to/new/directory/" <DIR>

You didn't mention the system you're using, so change double quotes into singles if on mac or linux.
Title: Re: What to look for to determine if the file was actually from a camera
Post by: grog808 on January 23, 2014, 06:16:36 PM
Thanks StarGeek!  I have a problem diving in too deep!  I just was browsing some of the other posts and was going to test something like that!
Title: Re: What to look for to determine if the file was actually from a camera
Post by: grog808 on January 23, 2014, 07:28:40 PM
I know i'm close...  I get the following on my testing...

Warning: No writeable tags set from /home/steve/Pictures/DSCN0733.JPG  (this file is actually the only one that has Make = Nikon)
    1 directories scanned
    2 files failed condition
    0 image files updated
    1 image files unchanged

there's 7 files in that Pictures directory, only 2 are jpeg.  The other jpeg file has no "Make" tag when queried by exiftool by itself.
Title: Re: What to look for to determine if the file was actually from a camera
Post by: StarGeek on January 23, 2014, 08:50:11 PM
What is the exact command you used?  Looks like you're not on a windows system, so did you single quotes instead of double quotes?
Title: Re: What to look for to determine if the file was actually from a camera
Post by: grog808 on January 24, 2014, 12:47:07 AM
i'm on ubuntu...

exiftool -if 'defined $Make' '-directory</media/BigBoy/pass1-sorted/good' /media/BigBoy/pass1-sorted/test/

slightly different now... i'm at home using a copy of files from the actual bad drive.
Title: Re: What to look for to determine if the file was actually from a camera
Post by: StarGeek on January 24, 2014, 01:01:17 AM
Oops, my mistake.  Change the "<" into an equals sign.  You use "<" if you're using a tag name, "=" if just setting it to a value.  That's why you get "No writeable tags set from /home/steve/Pictures/DSCN0733.JPG".  It's trying to use "/home/steve/Pictures/DSCN0733.JPG" as a tag.

So, this command should work (I think ;))
exiftool -if 'defined $Make' '-directory=/media/BigBoy/pass1-sorted/good' /media/BigBoy/pass1-sorted/test/
Title: Re: What to look for to determine if the file was actually from a camera
Post by: grog808 on January 24, 2014, 01:06:23 AM
worked like a charm!  You da Bomb, StarGeek!