ExifTool Forum

ExifTool => Newbies => Topic started by: U_turn on August 06, 2018, 05:45:41 PM

Title: SourceFile output for some files gets embedded within quotation marks (")
Post by: U_turn on August 06, 2018, 05:45:41 PM
While trying to list all images with some tag set, I get most image filenames and paths in plain, but some are embedded within quotation marks ("). And I can't figure out the pattern or a cause for this behavior.  I see that it doesn't happen random, as the same image filenames and paths are always embedded. I would guess that it's because of space char in their filename or path, but not all filenames and paths with space char are embedded...

Used command:
exiftool.exe -charset FileName=cp1257 -r . -ext JPG -m -if "$sometag" -csv -sourcefile

Title: Re: SourceFile output for some files gets embedded within quotation marks (")
Post by: StarGeek on August 06, 2018, 07:31:02 PM
Do you have some examples?

How about a comma in the name?  If there's a comma in the name, then it must be quoted.   Otherwise no program would know the proper place to separate the columns.

Accent marks, special characters, or similar stuff?

I just ran a simplified form of your command on a directory with over 1,000 files and nothing came back quoted, so more info is needed.
Title: Re: SourceFile output for some files gets embedded within quotation marks (")
Post by: U_turn on August 07, 2018, 04:12:03 PM
Thanks for a tip, StarGeek, and sorry for failing to notice commas in some of my filenames :)
Yes, it was about having commas...

In any case, as I'm trying to parse output with another command, is there a way to get all filenames quoted or not quoted?
As far as I understand, -sep option doesn't work with -csv

Thanks
Title: Re: SourceFile output for some files gets embedded within quotation marks (")
Post by: StarGeek on August 07, 2018, 06:09:07 PM
Quote from: U_turn on August 07, 2018, 04:12:03 PM
In any case, as I'm trying to parse output with another command, is there a way to get all filenames quoted or not quoted?

Not with the -csv option (https://exiftool.org/exiftool_pod.html#csv-CSVFILE) alone, you would have to roll your own csv with the -p option (https://exiftool.org/exiftool_pod.html#p-FMTFILE-or-STR--printFormat).  See FAQ #12 (https://exiftool.org/faq.html#Q12).  Near the end of that entry, it gives you a example of a FMT file that would duplicate a CSV output.  Just replace it with the tags you want to pull and put quotes around them, like this:
#[HEAD]FileName, Aperture, ISO
"$filename", "$aperture", "$iso"


Example output:
C:\>exiftool -p temp.txt y:\!temp\Test3.jpg
FileName, Aperture, ISO
"Test3.jpg", "0.33", "640"
Title: Re: SourceFile output for some files gets embedded within quotation marks (")
Post by: U_turn on August 08, 2018, 01:55:36 AM
Thanks, StarGeek, but what should I put as a format string to get SourceFile? $SourceFile is not recognized by -p...

Quote from: StarGeek on August 07, 2018, 06:09:07 PM
Not with the -csv option (https://exiftool.org/exiftool_pod.html#csv-CSVFILE) alone, you would have to roll your own csv with the -p option (https://exiftool.org/exiftool_pod.html#p-FMTFILE-or-STR--printFormat).  See FAQ #12 (https://exiftool.org/faq.html#Q12).
Title: Re: SourceFile output for some files gets embedded within quotation marks (")
Post by: U_turn on August 08, 2018, 02:16:12 AM
No worries, I found solution by myself. -p $directory/$filename does the trick instead of SourceFile.

Quote from: U_turn on August 08, 2018, 01:55:36 AM
Thanks, StarGeek, but what should I put as a format string to get SourceFile? $SourceFile is not recognized by -p...

Quote from: StarGeek on August 07, 2018, 06:09:07 PM
Not with the -csv option (https://exiftool.org/exiftool_pod.html#csv-CSVFILE) alone, you would have to roll your own csv with the -p option (https://exiftool.org/exiftool_pod.html#p-FMTFILE-or-STR--printFormat).  See FAQ #12 (https://exiftool.org/faq.html#Q12).
Title: Re: SourceFile output for some files gets embedded within quotation marks (")
Post by: StarGeek on August 08, 2018, 11:27:54 AM
There is also the FilePath tag.