The EXIF specification can be found here:
http://www.exif.org/specifications.html
You will need to read the EXIF data, and find the entry which contains a "tag" of 37386 or 0x920A. This is followed by a "RATIONAL" number, which is essentially two unsigned integers forming a fraction, for example 400/20 = 20 mm, as is 80/5 or 20/1. A 14.5mm lens would have to be (at least) stored as 29/2, but could be stored as 145/10 or 1450/100 - or a large number of other variants.
Of course, if you use for example ExifTool, you can easily do this with a script, or use it's Perl binding to write a script in Perl.
There is also a C++ interface to use with exiftool: http://owl.phy.queensu.ca/~phil/cpp_exiftool/
Using the TagInfo
that you get back from ImageInfo()
, it should be possible to find the FocalLength and move the files accordingly.
I'm not going to write the code for you, but the above information should be able to give you an idea.