Ever spend ages thinking up ways to convince someone a task is far from easy, and that they should just give up on the idea – and then the solution appears just as you were about to hit the Send button?
Well, the other night I had an interesting email from someone who has my Search and Replace plug-in for Lightroom:
… I need to remove text (“Scan_”) from the filename for images I scanned 4-5 years ago (and are now in my LR catalog). It appears [Search and Replace] does not work on filenames, only on metadata. Pre-LR catalog I used a utility to do bulk file name changes on folders of files, but that will be a problem with the LR catalog.
I could use the bulk filename changing tool, then delete the LR-cataloged-but-missing-image and then reimport the newly rename files. But it seems risky and I’d lose metadata for the images w/o XMP files.
It’s not unreasonable that users would want to replace text as part of a batch renaming process. It was possible in iView/Expression Media, and Bridge’s renaming dialog box has a similar “string substitution” feature. But this feature wasn’t yet in Bridge when Lightroom 1.0 was launched, and I suspect Lightroom fell victim to “you couldn’t do it in Bridge” thinking. Sadly, this weakness has never been addressed.
Anyway, I began writing my reply by saying I couldn’t adapt Search & Replace to handle file renaming – plugins can’t rename photos. I added a couple of lengthy paragraphs explaining how the user’s idea of reimporting the renamed files was workable if you weren’t worried about losing all the Lightroom work that isn’t stored in the XMP – flags, stacks, virtual copies, assignment to collections, and history steps. You might summarise my response as “Computer says No” (Little Britain, if the reference isn’t clear!).
And then, for some unknown reason, the solution was obvious:
- Use Search & Replace’s Transfer command to copy the file name to an unused IPTC field – it must be one such as Headline that Lightroom’s Batch Rename dialog can access
- Use Search & Replace to remove “Scan_” from the field
- Use Search & Replace to remove the extension from the field
- Finally use LR’s Rename Photos command to rename the files using the field in the renaming template
Easy. And a whole lot easier than I ever thought it might be!