Can I output exif data without the first sourceFile column?

Started by Raffie77, May 07, 2020, 01:31:26 AM

Previous topic - Next topic

Raffie77

Hello,
when I enter a command like this:
exiftool -csv -common photo1.jpg > test.csv
I get something like this as a output:
"/a/long/path/with/some/subfolders/photo1.jpg","photo1.jpg",125,auto,etc,etc

can I skip the first column sourceFile?
in my case the output looks neater without the sourceFile

sevy

Hello,

I don't think. It's seems to be used as identifier.
This column is also necessary if you want to add metadata through a csv file

StarGeek

No, it can't be suppressed when using the CSV option.  But you can use the -p (printFormat) option to create a csv file any way you want.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Raffie77

ok I'll take a look at the format option I didn't knew if that was possible
thanks for the tip

Phil Harvey

With the -p option writing CSV format, values must be quoted if they contain any special character such as comma, newline, quote, etc.  You can do this by adding this to your command:

-api filter="$_ = qq{""$_""} if s/""/""""/g or /(^\s+|\s+$)/ or /[,\n\r]/"

I think this is the way the quotes should be escaped for Windows.  For other OS's it would be simpler:

-api filter='$_ = qq{"$_"} if s/"/""/g or /(^\s+|\s+$)/ or /[,\n\r]/'

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

Raffie77

Yes it works
thanks
I created test.fmt:

#[HEAD]Filename,Date,Aperture,Shutterspeed,ISO,Megapixels
$FileName,$DateTimeOriginal,f/$Aperture,${ShutterSpeed}s,$iso,${megapixels}
#[TAIL]

And I execute this command:

exiftool -f -p test.fmt 00.JPG 001.JPG 920.JPG > test.csv ; cat test.csv
    3 image files read
Filename,Date,Aperture,Shutterspeed,ISO,Megapixels
00.JPG,2020:05:07 10:04:47,f/4.5,1/125s,800,8.3
001.JPG,2009:04:19 14:30:41,f/6.3,1/125s,-,6.0
920.JPG,2012:06:09 15:13:12,f/4.7,1/80s,125,14.0


Thanks guys for the help

btw @Phil Harvey
it works fine now without your sugestion of the -api filter

oh wait it didn't, the gps cordinates are comma separated and that messes the layout up.
your suggestion did the trick :-)
It works now

Phil Harvey

Great.  I've added a note in FAQ 12 to document this use of the -api filter option.

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