Author Topic: extracting fields for a spreadsheet  (Read 1795 times)

pixlmonkey

  • Newbie
  • *
  • Posts: 4
extracting fields for a spreadsheet
« 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?

pixlmonkey

  • Newbie
  • *
  • Posts: 4
Re: extracting fields for a spreadsheet
« Reply #1 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?

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3976
Re: extracting fields for a spreadsheet
« Reply #2 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 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.
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.

pixlmonkey

  • Newbie
  • *
  • Posts: 4
Re: extracting fields for a spreadsheet
« Reply #3 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.

Alan Clifford

  • ExifTool Freak
  • *****
  • Posts: 479
    • A selection of Alan Clifford's photographs
Re: extracting fields for a spreadsheet
« Reply #4 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.


pixlmonkey

  • Newbie
  • *
  • Posts: 4
Re: extracting fields for a spreadsheet
« Reply #5 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.

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 3976
Re: extracting fields for a spreadsheet
« Reply #6 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)
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.