extracting fields for a spreadsheet

Started by pixlmonkey, November 18, 2016, 04:20:37 PM

Previous topic - Next topic

pixlmonkey

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?

pixlmonkey

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?

StarGeek

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 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.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

pixlmonkey

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.

Alan Clifford

Quote from: 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?

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.


pixlmonkey

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.

StarGeek

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)
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).