Including filenames in error messages

Started by Viktor Nemeth, March 05, 2025, 04:25:40 AM

Previous topic - Next topic

Viktor Nemeth

Hi,

I wonder if there is a way to achieve the following:
I have an args file which contains some errors, such as: (note the dates. originally my issue had been that when i was running with correct dates but yyyy:mm:dd formatting through my app, it threw an error, but via cmd it does not. Alas I am now forcing the error through malformed dates)

D:\temp\Allatok\Hattyu_000_MOD_20240703.jpg
-ignoreMinorErrors
-progress
-XMP:DateTimeOriginal=202x:03-06 08:44:57
-EXIF:DateTimeOriginal=20x5:03-06 08:44:57
-overwrite_original_in_place
-iptc:codedcharacterset=utf8
-IPTCDigest=
-execute

then I just do

d:\temp>exiftool  -@ args.args
Warning: Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in XMP-exif:DateTimeOriginal (PrintConvInv)
Warning: Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z]) in ExifIFD:DateTimeOriginal (PrintConvInv)
======== D:/temp/Allatok/Hattyu_000_MOD_20240703.jpg [1/1]
    1 image files updated

Is there a way to prepend the file name to the error itself? Basically if I had more than 1 file to run then the error-output hits the output stream before the "normal" output does and so at the time of the first occasion I have no way to extract the filename.
So I'd preferably like something like Warning: {filename} -> {error} preferably in a way that I could split the message by some unique character or string (so not ":", unless we can take for granted that the filename appears between the first and second occurrence of ":")

Thank you

Phil Harvey

These specific errors occur while parsing your command-line arguments, and before any files are processed.  If they happened while processing a file then the file name would be appended to the message.

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