Author Topic: SourceFile output for some files gets embedded within quotation marks (")  (Read 643 times)

U_turn

  • Newbie
  • *
  • Posts: 4
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


StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 2569
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.
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

U_turn

  • Newbie
  • *
  • Posts: 4
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

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 2569
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 alone, you would have to roll your own csv with the -p option.  See FAQ #12.  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:
Code: [Select]
#[HEAD]FileName, Aperture, ISO
"$filename", "$aperture", "$iso"

Example output:
Code: [Select]
C:\>exiftool -p temp.txt y:\!temp\Test3.jpg
FileName, Aperture, ISO
"Test3.jpg", "0.33", "640"
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

U_turn

  • Newbie
  • *
  • Posts: 4
Thanks, StarGeek, but what should I put as a format string to get SourceFile? $SourceFile is not recognized by -p...

Not with the -csv option alone, you would have to roll your own csv with the -p option.  See FAQ #12.

U_turn

  • Newbie
  • *
  • Posts: 4
No worries, I found solution by myself. -p $directory/$filename does the trick instead of SourceFile.

Thanks, StarGeek, but what should I put as a format string to get SourceFile? $SourceFile is not recognized by -p...

Not with the -csv option alone, you would have to roll your own csv with the -p option.  See FAQ #12.

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 2569
There is also the FilePath tag. 
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.