Filenames
Twice recently I’ve seen people asking about getting a simple list of filenames to copy and email, and I wrote this little script for one of them. But I just saw someone asking again, so here it is (zip file) – free in celebration of my having gone through January without a beer, glass of wine, sip of single malt etc.
In your LR application support folder (find it by Preferences > Presets > Show Lightroom Presets Folder), create a folder called Scripts. This new folder should be in the same Lightroom folder as ones like Smart Collection Templates, Text Style Presets etc.
Unzip the file and save the little lua file in there, restart LR and you’ll have a scripts menu to the right of Help. Select a bunch of pictures, run the Filenames script, and you’ll see something like this:
Update (to celebrate Pancake Day)
You can easily modify this script to get other fields. The key line is getFormattedMetadata(‘fileName’) where the script calls a function and passes LR’s internal field name as an argument. So you just need to copy the script and change that field name?
Well, not quite. How do you know the internal field names? And some fields need to be called with the getFormattedMetadata function, others with getRawMetadata. So while you can guess the field name or work it out by editing a metadata template in Notepad/TextEdit, you really need to look up the field in the Lightroom 4 SDK under LrPhoto.
In the comments Hans asked about the full folder path, so in this case you’d just change getFormattedMetadata(‘fileName’) to getRawMetadata(‘path’). Restart LR and you’re done.
Incidentally, if you have Photoshop or the Creative Suite, you can use the Extend Script Toolkit as your editor instead of Notepad/TextEdit. It allows you to format the code for Lua and it’s not over the head of those like me who’re unnaturally frightened of real programmers and their very clever integrated editing environments.
Hello. Is this script still working with the latest CC version of Lightroom?
Thank you, Bruce
PS I have two of your books
Without testing it, Bruce, I would say 99.9% yes.
Hope the books have served you well 🙂
Thanks a lot for this script, I’m so a newbie to this.
Just wonder how I would need to modify it to only have the file name (without file extension). My goal is to find a list of exported jpegs with the list of CR2…
Do you think it’s possible ?
THanks a lot for your help
string.sub(filename, from, to) is the code
Very useful thing! Great job! Thanks, John!
You rock man! This script is EXACTLY what I needed. It saved me a ton of time. Thanks a bunch!
Another satisfied customer.
Used to purge duplicates from online and backup storage:
* build a list of duplicates.
* run the script (modified for full pathnames)
* use a text editor to remove common path prefix and append “rm ” to the front.
* run the script locally, and in each backup location, from the common root directory
* THEN remove the files from lightroom.
Thanks
Im not one to make comments on websites that I dont visit often, but what you just offered was exactly what I was after, and I felt inclined to comment here and tell you that its awesome! Simple, Clean, to the point! Fantastic job and I will be having a good few pints in your honor! 🙂
Glad you found it useful!
This is great! Just what I needed in the moment. Quick to implement and works great. Thanks for sharing.
Nice and useful script, thanks.
How about including the full path with each file name – maybe as an option?
I’ve got a script that provides full paths but also exports images for external processing. Unfortunately I cannot manage to get rid of the export portion only.
Your scripting approach seems very much simpler and easily accessible from the top-menu-bar.
It would be easy enough for you to hack my script, Hans. I’ll update the post to explain more, but the field names are listed in the SDK under LrPhoto. Some need to be called with getFormattedMetadata, others with getRawMetadata. So in your case, just change getFormattedMetadata(‘fileName’) to getRawMetadata(‘path’) .
yep, that’s it, thanks at lot.
There are so many functions in the SDK. It’s often really hard to find the one needed.
Thanks for sharing John – much appreciated. Is it safe to raise a glass towards you now? 🙂
It certainly is – I just had my first pint of the year. One called “Comfortably Numb”….