ExifTool Forum

ExifTool => Newbies => Topic started by: charpg on May 08, 2013, 10:11:11 AM

Title: serial number extraction
Post by: charpg on May 08, 2013, 10:11:11 AM
Hello,

I'm new using ExifTool but highly impressed by what it can do.

I'm using two Nikon D700 bodies and I would like to enrich the filename in function of the Serial number.
From what I understood, the Serial number is a Nikon special tag that should be addressed with something like 0x001d, but I don't know how to do that.

Basically, I'd like to add D700A to the filename if Serial number indicates my first D700 and D700B if serial number indicates my second D700. I'm using a Mac with Mac os Lion

Can you help, generous gourou's :-)

Many thanks in advance,
Gaƫtan
Title: Re: serial number extraction
Post by: Alan Clifford on May 08, 2013, 11:54:05 AM
I have a d7000 so I should think the tag will be the same. You should be able to see the serial number with
exiftool -serialnumber filename.ext

for example exiftool -serialnumber ahc_2760.jpg
Serial Number                   : 6054978


Then put your serial number in a conditional
exiftool '-filename=%f_d700a.%e' -if '$serialnumber eq 6054978'  ahc_2760.jpg

giving a new filename of
ahc_2760_d700a.jpg


I'm sure Phil will reply with more nuances with this sort of code.
Title: Re: serial number extraction
Post by: Phil Harvey on May 08, 2013, 08:31:04 PM
Thanks Alan,

You can add the serial number to the file name of all images in a directory ("DIR") like this:

exiftool "-filename<%f_$serialnumber.%e" DIR

Double quotes like this for Windows, or single quotes as Alan used for Mac/Linux.

- Phil