Finding Files with ExifTool Errors

Started by jcharmon, October 22, 2013, 12:26:44 PM

Previous topic - Next topic

jcharmon

I have a large collection of images with metadata added over the years with various software. Some of these images have had problem or corrupt metadata and ExifTool produced errors for them. (I know files can also produce ExifTool warnings, but I'm not as concerned about warnings at the moment.) I want to locate any remaining problem/corrupt files so I can finish cleaning up their metadata (per ExifTool FAQ #20).

An earlier posting (https://exiftool.org/forum/index.php/topic,3906.msg18111.html) described using something like this syntax to create a list of such files:
exiftool -all -r [Folder Name] > nul 2> error.txt

However, I'm not sure my code is working properly, or else I've successfully cleaned up all my problem files! Is this the right approach, or am I missing something?


Phil Harvey

The error checking is more extensive when ExifTool rewrites the image, so you won't be able to determine the files with errors without trying to write to them.  ExifTool really isn't designed as an image validator, so the solution using ExifTool isn't ideal, but you could try writing something to all the images with output to a scratch directory, like this:

exiftool -artist=me -o scratch/ DIR

then delete the scratch directory when you are done.

The files with errors will be indicated in the console output.  You could pipe stderr to a log file with something like 2> error.txt if you want.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jcharmon

Thanks for the really quick response! I appreciate the additional insights.

It also appears that the -all flag suppresses errors, whereas using (for example) -keyword flag that matches files does yield error outputs if they exist.

Phil Harvey

Nothing should suppress read errors, but warnings are not printed if any valid information is returned.  The thing to do here would have been to request -error -warning instead of -all or another tag.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jcharmon

I tried this:
exiftool -error -r [Directory] > nul 2> error.txt
This did find over 400 files with warnings. (Perhaps half of these were minor warnings. Quite a few are cell phone images with unrecognized maker notes, which doesn't surprise me. But there were a significant number with more serious errors I need to correct, e.g., Invalid PrintIM header, Bad InteropOffset SubDirectory start, Bad ExifIFD directory, etc.)

Where are the -error and -warning flags documented? I searched  the ExifTool documentation but must have missed them.

I'll try your suggestion to try writing output to a scratch directory, to see how many additional errors/warnings get generated from ExifTool rewrites.

Phil Harvey

#5
Quote from: jcharmon on October 22, 2013, 09:39:43 PM
Where are the -error and -warning flags documented? I searched  the ExifTool documentation but must have missed them.

All extra tags like this are listed here, although I don't provide any additional details about the Error and Warning tags.  Perhaps I should.

Many of these extra tags have very useful functions, so perhaps I should find some way to make this documentation easier to find.

- Phil

Edit:  I have added a description of the Error and Warnings tags in the documentation.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

jcharmon

Quote from: Phil Harvey on October 23, 2013, 07:16:39 AM
Many of these extra tags have very useful functions, so perhaps I should find some way to make this documentation easier to find.
Edit:  I have added a description of the Error and Warnings tags in the documentation.
Making the 'Extra' tags information easier to find would be very helpful. Thanks (when you have the time; in the meantime, thanks for adding info about -error and -warning).