Exiftool - Library Disaster of Own Making

Started by Strop, July 22, 2014, 02:50:12 AM

Previous topic - Next topic

Strop

Hi,

I have managed to totally destroy the integrity of my photo library mixing thumbnails, masters and god knows what else.  In looking to see how I might recover from this I have come to the decision I need to use two tools.  Exiftools and Hazel.  I can see that various images have different data that I can use to resort and recover from my mistake.  I am hoping Exiftools can be used to extract data from the images and I can use Hazel to organise my files again.

To use the together I have to use Exiftools in the conditional rules of Hazel that requires a script.  I was going to use various fields in the Exif Data to sort my mess.  As such I have no idea on if Exiftools can be used in this way.  I also have no idea on how to correctly write a script.  I was thinking of something like this:

if [ $(exiftool -DateTimeOriginal $1) == "" ]
then
        Exit 1
else
        Exit 0
fi


I know this does not work.  I am using this example as I believe all the thumbnails I have mixed in with the masters DO NOT contain anything in the DateTimeOriginal field.  You get the idea.

Can this be done?  If so help......  :-[ :-[

Phil Harvey

First, it's ExifTool, not ExifTools.

If you want to use ExifTool to perform a condition, this is the way to do it:

exiftool -if '$datetimeoriginal' -aaa FILE

where FILE is the name of a file.  Here I use bogus tag Aaa so exiftool doesn't return anything.

the exit value from exiftool will be 0 if DateTimeOriginal existed, or 1 if it didn't.

I'm not sure what you have Hazel doing to organize your images, but if it helps you can use ExifTool to move and/or rename files, and do this easily on entire directories:

exiftool -if '$datetimeoriginal' '-directory=/home/Strop/no_metadata' DIR

or if you want to isolate the small thumbnails:

exiftool -if '$imagewidth < 200' -directory=/home/Strop/pictures/thumbnails /home/Strop/pictures/big_mess

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

Strop

Phil,

thank you very much for your assistance.  I will try the examples you have given me and hopefully all will be good.

Sorry about the name

Laurie