I’ve spent a large chunk of my leisurely holiday in Pune trying to continue my “return to Lightroom“. Amongst the various problems I’ve had to solve, one of them was that many of the filenames in my library had one or two leading spaces. How, why? I don’t know. But it creates problems when you want to match files by filenames to weed out duplicates (with Photosweeper for example).
Here’s how I did things, using a plugin called LR/Transporter, and messing with .csv files. Warning: don’t do this if you don’t understand what you’re doing — you can really mess things up!
Adapted from my post on the Lightroom Queen forum:
- I sorted my whole catalog by file name so that those with the leading spaces would be listed first, and selected them.
- I used LR Transporter to export File name + file name base to a file
- I edited this file in Numbers (Excel messed up the encoding, some of my file names have accented characters in them, Google Sheets removed the leading whitespace)
- Copied the column containing the base file name to another table, did a search and replace for two spaces to remove them
- Trickier: what about one leading whitespace? Some of my filenames have spaces in them, so I can’t just “remove spaces”. I used the “concatenate” function to add a second leading whitespace to those files, then did another search and replace for two spaces, then copied the formula results back onto the original cells.
- I now have a two-column spreadsheet with the filenames (whitespace included) in the first column, and the second column has the base filename with leading whitespace stripped off.
- I export as CSV after having removed extra columns and empty cells
- In Lightroom, I go back to my selected photos, and Import metadata with LR Transporter: I map the “file base name” field to a metadata field that I don’t use, but that can be used as an “ingredient” in a file renaming preset. I chose “Instructions”.
- After import, these files should all have their future filename base listed in the “Instructions” field.
- Rename the files, composing the new name with the metadata field that has been used to store the whitespace-stripped base filename (in my example, “Instructions”)
- After that, just empty the “Instructions” metadata field if you wish!
Hope this might come in handy to someone!
- Apple Photos to Lightroom Classic CC: Step 2 [en] (2018)
- Moving From Apple Photos to Adobe Lightroom Classic CC [en] (2018)
- Getting Your iCloud Photostream to Play Nice With Lightroom [en] (2012)
- A Plugin to Compensate for Flickr Broken Embed Suckage? [en] (2012)
- Photos Online on Flickr, Facebook, and Google+ With Lightroom [en] (2013)
- Back to Lightroom [en] (2018)
- Photo Sync: Figuring Out Lightroom Mobile and iCloud Photo Library [en] (2015)
- Twitter @Replies Kerfuffle: Not Just About Discovery [en] (2009)
- Progress in Restoring CTTS [en] (2009)
- Fiddling With Video: Lightroom, YouTube, and iMovie [en] (2013)
Also published on Medium.