LR/Transporter: Renaming Files With Excess Whitespace in Lightroom CC Classic [en]

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:

  1. I sorted my whole catalog by file name so that those with the leading spaces would be listed first, and selected them.
  2. I used LR Transporter to export File name + file name base to a file
  3. 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)
  4. Copied the column containing the base file name to another table, did a search and replace for two spaces to remove them
  5. 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.
  6. 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.
  7. I export as CSV after having removed extra columns and empty cells
  8. 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”.
  9. After import, these files should all have their future filename base listed in the “Instructions” field.
  10. 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”)
  11. After that, just empty the “Instructions” metadata field if you wish!

Hope this might come in handy to someone!


Also published on Medium.

Leave a Reply

Your email address will not be published. Required fields are marked *