ExifTool Forum

ExifTool => Newbies => Topic started by: mdlr on April 19, 2018, 10:31:51 PM

Title: Prepend slash to SourceFile?
Post by: mdlr on April 19, 2018, 10:31:51 PM
I am using the follwing command to extract image data to a CSV:

exiftool -csv -r -filename -imagewidth -imageheight assets/photo/ > _data/images.csv


Which results in:

SourceFile,FileName,ImageWidth,ImageHeight
assets/photo/A.jpg,A.jpg,632,790
assets/photo/B.jpg,B.jpg,1280,800

In order to import this data, I need to prepend a slash to the SourceFile field; e.g. "/assets/photo/A.jpg"

Is there a way to do this?
Title: Re: Prepend slash to SourceFile?
Post by: Phil Harvey on April 20, 2018, 07:17:01 AM
One way to do this is to generate the CSV yourself using the -p option:

exiftool -echo "SourceFile,FileName,ImageWidth,ImageHeight" -p "/$directory/$filename,$filename,$imagewidth,$imageheight" assets/photo > _data/images.csv

This should work as long as no filename contains a comma or a quote.

- Phil
Title: Re: Prepend slash to SourceFile?
Post by: mdlr on April 20, 2018, 09:52:25 PM
Quote from: Phil Harvey on April 20, 2018, 07:17:01 AM
One way to do this is to generate the CSV yourself using the -p option:

exiftool -echo "SourceFile,FileName,ImageWidth,ImageHeight" -p "/$directory/$filename,$filename,$imagewidth,$imageheight" assets/photo > _data/images.csv

This should work as long as no filename contains a comma or a quote.

- Phil

Works like a charm. Thanks, Phil.