Thanks @pehar! I think my main problem might be the renaming operation. How do i rename both a raw file and all its connected XMP files (main sidecar and possibly duplicate manager sidecars)?
This is the command I used to set DateTimeOriginal tag for raw and sidecar simultaniously, in this case for all corresponding files in image-folder.
exiftool -DateTimeOriginal="1997:03:06 12:00:00" -overwrite_original -ext ARW -ext xmp /path/to/your/image-folder
In your case, you would need something like .../file-folder/basename with wildcards ? and/or *.
If you can’t rename your files using an exiftool one-liner, you could write a Bash script, if necessary with multiple calls to exiftool.
Hmm, but I have the correct date/time in DateTimeOriginal in the raw file. The filenames of the .xmp files and rdf:Description exif:DateTimeOriginal in the .xmp files are wrong.
Raw file DateTimeOriginal needs to go into rdf:Description exif:DateTimeOriginal. Then the filenames for raw files and .xmp files needs to be rewritten based on the correct metadata.
Possibly you could use
as a template ?
Thanks!
ExifTool restructures the XMP file quite a lot. I wonder if any developer of darktable, such as @Pascal_Obry or @hanatos (sorry for bothering), knows if ExifTool’s handling of darktable XMP files is okay.
Here’s before shifting:
before_20221223_155256_00.CR3.xmp (50.7 KB)
Here’s after ExifTool shifting:
after_20221223_155256_00.CR3.xmp (55.4 KB)
As an example, this:
<rdf:Description rdf:about=""
xmlns:exif="http://ns.adobe.com/exif/1.0/"
xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
xmlns:xmp="http://ns.adobe.com/xap/1.0/"
xmlns:darktable="http://darktable.sf.net/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:lr="http://ns.adobe.com/lightroom/1.0/"
exif:DateTimeOriginal="2022:12:23 15:52:56.680"
xmpMM:DerivedFrom="20221223_155256_00.CR3"
xmp:Rating="0"
darktable:import_timestamp="63911284761214689"
darktable:change_timestamp="-1"
darktable:export_timestamp="-1"
darktable:print_timestamp="-1"
darktable:xmp_version="5"
darktable:raw_params="0"
darktable:auto_presets_applied="1"
darktable:history_end="17"
darktable:iop_order_version="2"
darktable:history_current_hash="a841d1232a1022cfb00b5ad22d76687c">
Becomes:
<rdf:Description rdf:about=''
xmlns:exif='http://ns.adobe.com/exif/1.0/'>
<exif:DateTimeOriginal>2022-12-23T14:52:56</exif:DateTimeOriginal>
</rdf:Description>
Also, notice the different formatting of the DateTimeOriginal.
If you use Exiftool to adjust the “DateTimeOriginal”, and then change the filename from within darktable, do you actually need to keep the sidecar? Any edits are stored in the darktable database.
I’m going to answer my own question here. I don’t think it works. This:
corrects the date in the XMP in a way that darktable reads correctly.
However, it somehow messes up the XMP metadata so that my edits (module settings, masks etc) don’t carry over. That is, when I open the raw file with the corrected XMP it loads with the correct date, but the edit is lost. ![]()
Hmm, the I don’t have any metadata traces left for these files in the DB. All I have is raw files with the wrong filename but correct DateTimeOriginal and XMP files with the same wrong name and incorrect metadata. It seems darktable does not care about the raw file DateTimeOriginal at import, so I can’t use that for renaming. I must adjust the XMP DateTimeOriginal first in order to be able to rename using darktable/Lua.
I can’t confirm that. The following workflow works for me without any loss of information:
- Start a fresh installation of darktable (here
5.5.0+988~ge42e0a0ce0) - Check Preferences → Storage → Look for updated XMP files on startup
- Import an image that has already been edited with the corresponding
xmpfile - Quit darktable
- Change the date and time (
DateTimeOriginal)in therawfile andxmpfile (or alternatively copy the tagrawfile toxmpfile) using exiftool - Restart darktable
- In the dialog that appears, select “Keep XMP edit”
- See the correctly updated date and time in Image Information → Datetime
- For me, all module settings and masks are preserved !
So I have no problems with it. Did you perhaps corrupt the xmp files during previous attempts?
I’m trying to use the “rename images” script, but it doesn’t work. A “rename images” button does indeed appear in the right panel of the lighttable; I define a renaming pattern; when I click “Rename,” a “renaming images” line appears at the bottom of the left panel, but nothing happens.
I am using Darktable 5.6.1 with Windows 10.
Thank you fir your help.
Can you check whether the images actually don’t get renamed in your file browser? I just checked in a Win10 VM and thought it didn’t work at first as well. There seems to be a bug that you need to once leave the current collection or restart darktable for the new name to show up.
Oh and make sure to also append the extension when using that script, it doesn’t do so (yet).
This has been a bug for some of us for awhile.
Open the file string.lua found in
AppData\Local\darktable-artistic\lua.OLD-2026-07-24\lib\dtutils\string.lua
Do a search for the following line:
version_multi, -- VERSION.IF_MULTI
and right below it add:
version_multi, -- VERSION.IF_MULTI
so you now have these two lines next to each other:
image.duplicate_index, -- VERSION
version_multi, -- VERSION.IF_MULTI
Yep, I found this issue by our own lua-wizard where he concluded that there was no elegant solution: Add lighttable refresh to rename_images · Issue #598 · darktable-org/lua-scripts · GitHub
Please describe, we’ll try to help.
The real question is: what’s the point?
Renaming for who since you should never look at the RAW files. A better alternative:
- Use tag with the person’s name for each photo
- Export using the tag in the exported filename
So at the end you have <name of person>.jpg without having the rename the picture.
The tag: people|myname
In the export module use $(CATEGORY0(people)) and you’ll get “myname”.
If you forget to properly name your files upon import and possibly use a custom naming scheme it is handy to have a renaming function within darktable.
@Emers, @mino, @leonidas111: thanks for your help. Unfortunately, I’m running into another issue. Since I’m away from home, I’m using my laptop, and the script module isn’t showing up in the left panel. I’ve been trying to fix this for a while but haven’t found a permanent solution. I thought I’d resolved it a few weeks ago, but the problem came back when I installed version 5.6.1. As the French saying goes, I’m tearing my hair out!
I’ve had the same issue yesterday while playing with my testing setup. Since I was only for testing I nuked the config and moved on… But I don’t know the cause.
Please start darktable from the command prompt with: C:\Program Files\darktable\bin\darktable.exe" -d lua
This will generate a log file in your documents folder/darktable. Please share that here.
I don’t usually rename, but I renamed to distinguish my color calibration shots to distinguish them: cloudy morning, very cloudy noon, shade, 5000K, etc. That way the title shows up when I mouse over the image, and is also visible in the filesystem. I’m also planning to start renaming images before export so they have a title if attached in an email. I may use the title metadata for this purpose in the future, but I haven’t figured out the appropriate template string.
I had to dig a bit, but to include a title in the export only if it exists (with an underscore), append this to the title name: $(Xmp.dc.title+_)$(Xmp.dc.title). And to do the same in the filmstrip and thumbnail hover metadata, include this at the end of the “Lighttable → Pattern for the thumbnail overlay*” options: $(Xmp.dc.title+$(NL))$(Xmp.dc.title)
I may have a fix…
EDIT: Found it, it’s a darktable fix and not a Lua fix. When the filename changed I just needed to raise a signal that the metadata changed and it causes the thumbnail metadata to refresh.
