does that mean that I have to type .$(FILE_EXTENSION) each time? If that was the case I would find typing the file extension myself quicker. Thanks for the reply.
If you rename images one by one yes. If you select a bunch of images and want to rename them to 20230930-$(FILE_NAME).$(FILE_EXTENSION) then using the variables makes sense.
Thanks Bill. It really isnât a big problem typing the file extension so I will do that. I truly appreciate you having written such a useful lua script. BTW, I often rename my images on import to include location details in name, but this script of yours is great for naming copies of images to use in my classes.
I hope it is ok to resurrect this thread; I had a question related to the rename_images.lua script and this is more or less in-topic.
First, I understand that you mostly donât need any renaming with darktable, so I totally get what most of the people here are saying, but sometimes I need to dig into the filesystem so file names (and renaming) are important to me.
What I realized now in 4.6 (not sure if this was the same also in earlier versions) is that dtâs variables (darktable 4.6 user manual - variables) are not the same as the one used in the script.
So when doing copy & import I use this pattern to rename files:
$(EXIF.YEAR)$(EXIF.MONTH)$(EXIF.DAY)$(FILE.NAME#IMG).$(FILE_EXTENSION)
to rename files like IMG_6222.JPG to 20230210_6222.JPG, relying on the string substitution magic $(var#pattern) to delete IMG from the filename.
However the same pattern wonât work in rename_images first because
- the variable names are different:
$(EXIF_YEAR)instead of$(EXIF.YEAR) - there is no string substitution magics
I thought that all these variables and magics are âcoreâ so they would work in main darktable and within LUA scripts too, but evidently theyâre not.
I wonder if @wpferguson has time to look at it? If thereâs something I can do let me know. And thanks!
Itâs already in the works, Add substitution to string lib by wpferguson ¡ Pull Request #412 ¡ darktable-org/lua-scripts ¡ GitHub. I just need to get the tag substitution working and add the new variables that have been added to darktable in the last year.
thank you Bill! I did have a quick look in the github issues but couldnt find this â sorry I shouldâve looked better!
@wpferguson thanks for your work with this LUA script. It is brilliant for what I want.
I think it will be a useful feature, especially when we create duplicates in lighttable. At the moment, it is not easy to differentiate which is which. A file rename option will certainly be useful, even if it is implemented as an add-on variable, for example .
The duplicates in the lighttable use the same input image (only the XMP file is different â itâs numbered).
@PD1 you can rename the duplicate version to help differentiate which version you are looking at. I previously have suggested I wish I could do this with the snapshots I make so I can better different what each snapshot is showing me. But I didnât get much traction with that suggestion.

Or you didnât read the release notes
This is supported already, you can rename snapshots. Just ctrl+click on the snapshot button.
Thanks Pascal. Despite reading the release notes for 4.6 I didnât pick up on this change. It is a nice improvement. DT just keeps getting better. Thanks for all your work with DT as I really appreciate it. I try the weekly windows builds and look for the new features that pop up there, but some sneak past me.
Iâm new to Darktable, though Iâve been using Lightroom for 20 years. I agree that renaming images isnât necessary once youâve settled into a routine, but when youâre just starting out and need to migrate 100,000 photos from Lightroom to Darktable, renaming certain photos is more than just usefulâitâs practically a necessity.
I tried Bill Fergusonâs script, but I couldnât get it to work. I posted a message about it in another thread.
I am on Windows 11 DT 5.6. I have enabled the script for rename images
The module appears on the right side of lighttable or the left side of darkroom. It works brilliantly for me.
@Pascal_Obry I just rediscovered this post and rediscovered the ability to rename snapshots. So many great features in DT that it is just so hard to remember them all if you donât use specific ones on a regular basis.
I responded with the fix in the other thread.
See my response and workflow proposal here:
How?
Just ctrl+click on the snapshot button.
