ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: dwegner on June 04, 2019, 06:33:59 PM

Title: [BUG] -SourceFile tag reported twce in csv output when listing tags and using -f
Post by: dwegner on June 04, 2019, 06:33:59 PM
I'm using exiftool to pull specified tags out of a large number of image files and import them into a sqlite DB. When using the -f flag, it appears that the SourceFile tag is output twice. Here's a simplified example of the behavior:

CSV output with -SourceFile tag works as expected - the tag is output once:

./exiftool -ver -csv -SourceFile IMG_1075.JPG
11.48
SourceFile
IMG_1075.JPG

If you add the -f flag the column is repeated. This causes sqlite import of the resulting csv file to fail due to the duplicate column name. Also notice that the second value is incorrect:

./exiftool -ver -f -csv -SourceFile IMG_1075.JPG
11.48
SourceFile,SourceFile
IMG_1075.JPG,-

The workaround is to not specify the -SourceFile tag as it appears to be output by default even when listing other tags, but this is kind of unexpected behavior:

./exiftool -ver -f -csv -FileSize IMG_1075.JPG
11.48
SourceFile,FileSize
IMG_1075.JPG,4.2 MB

Title: Re: [BUG] -SourceFile tag reported twce in csv output when listing tags and using -f
Post by: StarGeek on June 04, 2019, 07:06:34 PM
There is no tag named SourceFile.  It only exists in the CSV output (see -csv option (https://exiftool.org/exiftool_pod.html#csv-CSVFILE), first paragraph).

If you run
exiftool -SourceFile IMG_1075.JPG
you will get no output, as there isn't anything to list.  The addition of the -f (ForcePrint) option (https://exiftool.org/exiftool_pod.html#f--forcePrint) forces exiftool to create output for this non-existent tag.  That's why you get a second column.
Title: Re: [BUG] -SourceFile tag reported twce in csv output when listing tags and using -f
Post by: dwegner on June 18, 2019, 12:13:32 PM
Thanks