Need advice on renaming batches of images in darktable.

In creating a separate catalog of images in darktable, I used ‘add to library’ in order to take advantage of a file organisation that met my needs. I failed to remember that a large number of these images still had camera-generated files names. Import using ‘add to llbrary’ does not allow me to rename the files in the way that ‘copy & import’ does. But I can’t use ‘copy and import’ because these files come with sidecars.

I’ve spent half a day experimenting with the ‘rename images’ lua script but I can’t seem to get it to work effectively on more than a single image at a time - and often my attempts to craft a meaning file name in the script dialog result either in the file being completely vaporised or no rename happening when a message says that the file has been renamed, or the abrupt ‘unable to do variable subsitution, exiting’ message.

I’m considering using one of the excellent external batch rename products available for Windows and Linux and dealing with the ‘skulls’ afterwards, which will be tedious, given the number of batches of files which need to be renamed. Are there better methods, using the asset management functions of darktable, that you might recommend?

I think you can export as a copy but use file parameters in the box… not sure if that works for you Then just import those and delete the other ones… do a test run first… not sure if this preserves edits but its a way to create a renamed copy

I think there is no way to do it inside darktable, but doing it outside shouldn’t be hard:

  • make sure the edits are saved in the xmp files
  • remove (don’t delete) the files from darktable
  • batch-rename the raw files and the matching sidecar file
  • add to library again

That’s almost exactly on the process I had envisaged, and actually started earlier today. The devil is in the detail though: my preferred renaming includes the date of the original capture, which dt can generate for me if I import using ‘copy and import’. The alternative is to examine the exif data, using tools like Exiftools or gthumb on a file by file basis. That’s unworkable for the number of renames I need to do, so my process is:

  • copy images and sidecars to a temporary folder
  • remove images from dt
  • copy & import from temporary folder, using dt to generate required filenames, which include the numerical part of the camera assigned file name. This step ‘loses’ the sidecars.
  • use the sort capability in the llghttable to identify batches of images taken on the same day, using the numerical remnant of the camera-assigned file name to define the batch limits
  • arrange the sidecars in the temporary folder into batches with the same date limits
  • batch rename the sidecars to match their associated image file
  • copy the sidecars into the dt managed image folder hierarchy
  • set the appropriate dt preference for the sidecars to be read on the next start of dt
  • finally, hit head on wall because of minor typing errors causing far reaching mayhem

I’ve done a few thousand images across a few dozen folders so far. Seems to be the result I wanted, so proof of concept achieved. Remaining 95% of job is now mere busy work.

Exiftool can rename files based on exif metadata, can be batched, and you can create a script that renames both the RAW and the sidecar. There are also multiple rename specific tools than can do the same with a GUI.

1 Like

image

This option copies the raw…renamed as deemed in the export dialogue with the current xmp ie in its current state… so if you had the space you could export them all somewhere with edits and they would be renamed and then import them back…seems like a lot of work. I would really only care about my exported jpg names for sorting or viewing on the phone or cloud …

It could have been a similar process but easier if you had used the copy setting in the export dialogue to do the renaming… that is if the DT variables and or any added suffixes and prefixes would work for your renaming…

Yes. I’m on Windows and use ‘Advanced Renamer’ to rename photos. It has Exiftool implemented which read date/time of the photos but from XMP too.
Advanced Renamer also let you chain multiple renaming methods in a list. Remove, Replace, Add, Remove Pattern, Rename by txt file etc. even RegularExpressions can be used. Very powerful.

Thanks for this. My renamer of choice, in the Windows environment, has been, for some years, the Bulk Rename Utility by TGRMN software, which is a commercial application, free for home use. It seems to have similar functionality to Advanced Renamer, such that I would describe it as ‘very powerful’ too. In addition I have had entirely satisfactory support from the developer. GPRename, in the Linux environment, in comparison, is crude in function and appearance and less usable, but has proved adequate for the simple job I need to do, allowing me to avoid using Windows.

Indeed it is - even using your much more elegant ‘export’ method. But nothing more than about 3 16 hour days - assuming the phone doesn’t ring, the kettle keeps working and old bladder problem doesn’t resurface…

1 Like

It’s a tool that both hugely impresses and intimidates me. It would take me longer to learn how to exploit exiftool to deliver these functions than it will to do it using the method I have ‘cobbled’ together. And I don’t intend to have to do this again. Shooting self in foot to match scar tissue on other foot is more than enough …

Hello there,

I never was able to properly rename files using Dt.
What I find difficult is the use of EXIF + handling of sidecar/xmp files

After trying many methods (shell + exiftools/exif, file renamers, … which are difficult to handles b/c of the sidecar files), what I do now is use DigiKam (and only for renaming files. Nothing more. I use the Appimage version.).
It enables using EXIF info for the filenames plus handles the sidecar natively.

Then, I simply re-add the folder to Darktable and remove the lost files appearing as skulls in Dt.

GLLM

Thank you for your update. I have now completed renaming this portfolio of images - about 50,000 spread across about 500 folders. I used a bulk renamer external to dt - in fact I alternated between two (Advanced Renamer and Bulk Rename Utility) to ‘enjoy’ the variety. Both these applications were run under windows and both handled the side car files without any problem. They were easy to use, with more than enough functionality.

I too used the ‘add to library’ approach to import the renamed files, which worked without problem (aside from the small number of user errors), on both my Windows and Linux installs of dt,. I avoided almost completely the appearance of skulls by removing the images from a folder, or collection of folders, at a time and then repopulating the folder via ‘add to library’.

I did this work under Windows after giving the Linux App GPRename my best shot. It was just too crude, with a poor UI and far too inefficient to justify any serious investment of my time. I also tried KRename: never again. It was the slowest Linux application I have ever used; literally minutes to list a set of files (usually less than 100) in a selected folder; that’s an operation which takes a few milliseconds with other applications.

In a few months I have to repeat the rename exercise on another large collection of files, spread across an order of magnitude more folders. Before then I must try to design a more productive workflow.

1 Like

I do all my WORKFLOW in darktable:
1 _ Import RAW
2_Sort (notes with stars from 3 to 5)
3_Select notes from 3 to 5
4_Save options > target storage > RENAME YYYMMDD_Theme
5_File format > copy (RAW)
6_EXPORT
7_Select the collection
8_Select > select all
9_Selected images>remove
10_Import images export
11_Caption, develop.

1 Like