First: I moved successfully from Lightroom to Darktable
I imported a lot of images where I miss the capture date in the EXIF data. Therfore chronologic sorting is not possible.
However the filename contains the capture data and time. E.g. 20230311_153804 or 2014-04-08 12.04.28.
Is there any chance to tell darktable to read the information from the filename and change the capture date and time in EXIF?
Thanks, Andreas
Welcome to the forum! It’s a treasure of tips and tricks
I think Darktable can’t do this, but you should be able to do this with “exiftool” on the command line. Do all files have the same filename scheme? Then it should be possible to process all files in one go (make sure you have a backup…)
I wonder if Digikam has some capabilities to do the job.
Well, changing the original capture timestamp is not something you usually want to do. In addition, changing metadata in raw files isn’t recommended.
Afaik, neither digikam nor darktable have a method to set timestamps from the filename. Darktable, afaik, refuses to write to original files (i.e. any file imported into it). Digikam will write to files, including some raw formats, but wont’t parse the filename.
Exiftool can set a new timestamp,but you’ll probably need to parse the filenames to extract the timestamps into the proper format for exiftool. Not sure if a shell script is powerful enough for that job.
This can be done with a lua script. The filename can be read, parsed, and the exif_datetime field in the image database record updated. The image file isn’t modified in any way.
If you send me a list of filenames with all the patterns used for date time, I can write the script.
Unzip it and drop the lua file in your contrib directory (~/.config/darktable/lua/contrib or %LOCALAPPDATTA\darktable\lua\contrib).
Start darktable and use script_manager to start the script.
Go to Settings->Shortcuts->Lua Scripts and assign shortcuts to the selection and collection items. You can the use the shortcuts to either select some images and the use the selection shortcut, or just do the whole collection with the collection shortcut.