- Joined
- Mar 21, 2018
- Messages
- 78
- Lightroom Experience
- Intermediate
- Lightroom Version
- Lightroom Version
- Lightroom Classic version: 7.5 [ 1186149 ]
- Operating System
-
- macOS 10.13 High Sierra
- iOS
Just putting this here in case it's useful to somebody. For some reason, many of my image files had leading whitespace (one or two spaces) in their filenames. Here's how I got rid of it.
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!
I had nearly 20k photos in my library that needed this treatment. Hope this might be useful to somebody!
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!
I had nearly 20k photos in my library that needed this treatment. Hope this might be useful to somebody!