ExifTool Forum

ExifTool => Newbies => Topic started by: pixlmonkey on November 18, 2016, 04:20:37 PM

Title: extracting fields for a spreadsheet
Post by: pixlmonkey on November 18, 2016, 04:20:37 PM
Hi, I'm looking to learn how to extract a series of exif fields from a directory of files for placement in excel.  This is my first time using this tool.

In a mac environment, I'd put this string in terminal:

exiftool -filename -filesize -bitdepth -csv -ext /Volumes/Images/hires/directoryname

But what then, where is the csv file written? And I'm not sure how to format it so that only the fields I need are in the output, and not the whole file path.

Any advice?
Title: Re: extracting fields for a spreadsheet
Post by: pixlmonkey on November 18, 2016, 04:30:32 PM
Ok, one workaround that sort of produced results was to copy exiftool results into a text doc, then open in excel and remove the path column.

But, is there a more elegant way of doing it?
Title: Re: extracting fields for a spreadsheet
Post by: StarGeek on November 18, 2016, 04:53:41 PM
You can redirect the output into a file with something like >out.csv.  Just add that onto the end of the command.  But as long as you use the -csv option, the filename column will appear in order to allow the reverse option (reading data from csv to put into files).

You can also look into the -p (http://www.exiftool.org/exiftool_pod.html#str) to create your own CSV formatted file.  That would be something like exiftool >out.csv -p '"$filename", "$filesize", "$bitdepth"'.  I'm assuming you're not on windows due to your pathname, if you are then the command would be different.

I haven't tested this out, so check to see if it does what you want.  If you were to use some other tags, you may run into problems doing it this way, because it doesn't take into account things like embedded double quotes or other oddities.
Title: Re: extracting fields for a spreadsheet
Post by: pixlmonkey on November 18, 2016, 06:01:05 PM
Thank you, oddly enough adding >out.csv did not produce a file.  I tried adding it after "-ext mov" with and without a space, as well as after the file path itself.  Wrong location?

As for the -p suggestion, i took a peek at that section, it's way over my head for now, but thanks.  I may research it later.
Title: Re: extracting fields for a spreadsheet
Post by: Alan Clifford on November 18, 2016, 07:28:50 PM
Thank you, oddly enough adding >out.csv did not produce a file.  I tried adding it after "-ext mov" with and without a space, as well as after the file path itself.  Wrong location?

In which directory were you looking for  out.csv?

later ...

exiftool -filename -filesize -bitdepth -csv -ext /Volumes/Images/hires/directoryname


You didn't specify the extention, eg -ext jpg so there was no output from your command when I tried it.

Title: Re: extracting fields for a spreadsheet
Post by: pixlmonkey on November 18, 2016, 10:04:17 PM
Thanks.  Yes, i did specify "-ext mov". I looked in the source folder, documents folder and desktop, couldn't find it.  I don't think I'm attaching the >out.csv parameter in the right location.
Title: Re: extracting fields for a spreadsheet
Post by: StarGeek on November 19, 2016, 01:03:26 AM
The file should be in the same directory that was in the command line prompt.   For example, when I open CMD on windows, the prompt says "C:\Windows\System32>"  and that would be where the file would be written. 

To have the file written elsewhere, you need to either change the working directory (cd /path/to/output/dir/ before running exiftool) or put a full path (>/Volumes/Images/hires/directoryname/out.txt)