serial number extraction

Started by charpg, May 08, 2013, 10:11:11 AM

Previous topic - Next topic

charpg

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

Alan Clifford

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.

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).