ExifTool Forum

ExifTool => Newbies => Topic started by: l_d_allan on August 31, 2010, 12:15:11 PM

Title: HowTo? rename .cr2 files with focal length & RegEx?
Post by: l_d_allan on August 31, 2010, 12:15:11 PM
ExifTool pre-newbie:

Based on the FAQ, I couldn't tell whether ExifTool can rewrite the filenames for .cr2 and .dng RAW files, and RegEx string substitution. I'd appreciate finding this out before tackling the learning curve.

Here's what I want to do:
* I shoot a lot of panoramas, and I find it handy to include the focal length in the file name in order to make it easier to tell where one pano ends and another begins.

* Suppose I have 2 panos of 2 images each, plus a blank frame that separates them. From a Canon DSLR with EF-S 18-55mm kit lens, they would have the following RAW names if shot today (Aug 31):
  - 18mm:   IMG_1234.cr2  IMG_1235.cr2
  - 55mm:   IMG_1236.cr2
  - 35mm:   IMG_1237.cr2  IMG_1238.cr2

* Here's what I want the above files to end up with for filenames:
  - 18mm:   100831_001234_Description_18.cr2  100831_001235_Description_18.cr2
  - 55mm:   100831_001236_Description_55.cr2
  - 35mm:   100831_001237_Description_35.cr2  100831_001238_Description_35.cr2

* Adobe Bridge CS4 BatchRename can do most but not quite all of what I want (RegEx string sub not implemented, so you end up with an extra dot character that can throw off some software).

* Bridge CS5 can do all of what I want, including RexEx string substituion of 18.0 mm to 18mm, but I can't justify the expense of upgrading from CS4 to CS5.

Can ExifTool do the above? Is there an example script for something similar that involves metadata?
Title: Re: HowTo? rename .cr2 files with focal length & RegEx?
Post by: Phil Harvey on August 31, 2010, 08:28:02 PM
This command may be what you want:

exiftool "-filename<${datetimeoriginal}_00%-4f_Description_${focallength#}.%e" -d %y%m%d DIR

where DIR is the name of a directory containing the images

[edit](use single quotes instead of double as above if you are on Mac or Linux)
Title: Re: HowTo? rename .cr2 files with focal length & RegEx?
Post by: l_d_allan on September 14, 2013, 02:40:28 AM
Thanks ... belatedly ... mea culpa.

It turns out that Adobe Bridge CS5 has a pretty decent rename capability. Perhaps I didn't notice it in CS4?