Export a list of file names and "date picture taken"
March 12, 2012 7:07 AM   Subscribe

For a given folder full of images, I want to export a list of file names and corresponding "date picture taken" values. NOT "date created," NOT "date modified." I'd like the file in .csv or .txt format. Can the Windows command line do this? Failing that, some freeware EXIF-reader program? Thanks!

By the way, this program claims to be able to export EXIF data as .txt or .xml, but I'm unable to figure out how. I haven't found any other programs that claim to do this.
posted by sleevener to Technology (7 answers total) 3 users marked this as a favorite
 
Best answer: This is a possible answer for the Windows command line, but it would require installing jhead and some version of Perl, and is a very Un*x-ish way to go about things. Here's a Perl script:
#!/usr/bin/perl -w
use strict;
my $filename;
while (<>)
{
   chomp;
   $filename = $1 if (/File\ name\s*\:\s*(.*)$/);
   if (/Date\/Time\s+:\s*(.*)$/)
   {
      print "\"$filename\",\"$1\"\n";
   }
}
If you save this as "exif2csv", you can then invoke it like:
jhead *.JPG | perl exif2csv
And it will give you output that looks like:
"HPIM0974.JPG","2007:11:24 14:31:46"
"HPIM0975.JPG","2007:11:24 16:05:29"
"HPIM0976.JPG","2007:11:24 17:28:52"
posted by straw at 8:10 AM on March 12, 2012 [2 favorites]


If you can view the property you want in the shell, you should be able to get at it from the PowerShell command line. I don't think there is a way to do it from cmd without something extra.
posted by jeffamaphone at 9:09 AM on March 12, 2012


This looks like a starting point.
posted by jeffamaphone at 9:11 AM on March 12, 2012


This is quite hacky, but IrfanView can rename files based on EXIF data (among other criteria). You'd end up with a rename string of something like $N__$E36868($Y $m $d).$O, and file names like IMG_0001__2012 03 12.jpg. Then you can pipe the results of dir into a text file, and find-and-replace the double underscore with a tab, get rid of any extraneous junk, and BOOM! You've got tab-delimited data!

(I haven't actually tried that rename string, test on a small area before use.)
posted by clorox at 9:32 AM on March 12, 2012


Response by poster: straw, thank you, I'll try that this afternoon. jeffamaphone, thank you too!
posted by sleevener at 9:32 AM on March 12, 2012


Response by poster: clorox, didn't see your answer, thank you for your help!
posted by sleevener at 11:29 AM on March 12, 2012


Response by poster: straw, it worked great! Thank you.

For future visitors whose dunderhead quotient meets or exceeds mine, I saved jhead and the perl script (exif2csv.pl) in C:, then on the command line I navigated to the folder where the images are, then pasted this instruction in:

C:\jhead *.jpg | perl C:\exif2csv.pl >namesdates.txt

It might take a while for lots of images, but it will spit out a file called namesdates.txt with the output that straw mentioned, in the same directory as the images.

Hooray! Success!
posted by sleevener at 1:07 PM on March 12, 2012


« Older I need a UK replacement passport in one day. Help   |   What should I do with my disposable income... Newer »
This thread is closed to new comments.