Exiftool force output of "image files read"

Started by sylikc, May 24, 2021, 03:16:50 PM

Previous topic - Next topic

sylikc

Phil,

Is there any way to force exiftool to always output full status reporting to stderr?  "image files read, image files unchanged, image files updated, files could not be read" etc...

Currently, if trying to read from a few files, if all is found, stderr is empty, but if any is not found then the statistics for how many were read or not read come out.  It'd be nice to be able to force that output if the option doesn't already exist.

And while you're at it, can the output be formatted to JSON?  at least if the -j flag has already been set?  ;D

Thanks,
/sylikc

Phil Harvey

See the -echo options for sending output to stdout and stderr.  You can do this to keep stderr from being empty.

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

sylikc

Phil,

I'm already using the -echo option to send output to stderr.  I do that to prevent a read block on stderr when there was otherwise no output.

However, is there a feature that shows how many files are processed each time?  I see in -echo that I can show EXIT STATUS.  But that's only 0, 1, and 2

When passing in invalid files, stderr shows an error message

for example, in a directory that has a rose.jpg...

______________________________________________________________________________________________________________

exiftool.exe -j rose.jpg -JFIF:JFIFVersion
stdout = [{
  "SourceFile": "rose.jpg",
  "JFIFVersion": 1.01
}]

stderr = (empty)

______________________________________________________________________________________________________________

rose.jpg doesn't have any makernotes:
exiftool.exe -j rose.jpg -MakerNotes
stdout = [{
  "SourceFile": "rose.jpg"
}]

stderr = (empty)

______________________________________________________________________________________________________________

notfound.jpg does not exist:
exiftool.exe -j notfound.jpg -MakerNotes
stdout = (empty)
stderr = Error: File not found - notfound.jpg

______________________________________________________________________________________________________________

exiftool.exe -j notfound1.jpg notfound2.jpg -MakerNotes
stdout = (empty)
stderr = Error: File not found - notfound1.jpg
Error: File not found - notfound2.jpg
    0 image files read
    2 files could not be read


______________________________________________________________________________________________________________

exiftool.exe -j rose.jpg notfound2.jpg -MakerNotes
stdout = [{
  "SourceFile": "rose.jpg"
}]

stderr = Error: File not found - notfound2.jpg
    1 image files read
    1 files could not be read


______________________________________________________________________________________________________________

exiftool.exe -j rose.jpg -MakerNotes=
stdout = (empty)
stderr =     0 image files updated
    1 image files unchanged



sylikc

in the outputs above, it would be nice to be able to force output of how many image files updated, unchanged, couldn't be read, etc... to be able to parse that from stderr programmatically.

That way I could report the status how many files were processed, in case a wildcard was passed in for the filespec, etc and know the results consistently?

Phil Harvey

If you pass more than one file name, then the summary message is printed.  So if you want, you could force the summary message by passing an extra bogus file name each time.  But there is no specific option to force this.

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