Reorganize photos on filesytem

Sometimes I need to reorganize my file structure. As such, this is quite easy, I just move stuff around with my file manager and re-import all pictures from their new location.

But Darktable still remembers tthe old film-rolls and I have to delete each one by one, by scrolling down, right-clicking the film-roll, selecting ‘delete’ and confirming that I want to delete. If you have 100 film rolls, this becomes very tedious and annoying.

Is there an easy and fast way to clean up the Darktable database which gets rid of all ‘dead’ refrences ?

Right click on a filmroll or a folder on collections module, then search filmroll should do the trick to update folder/filmroll path instead of removing it. To clean database, you have a purge files script (check on manual).

Avoid this is move the collections from within darktable.

Interesting!!

I found the purge_non_existing_images.sh script. It looks like I need to install the msys2 environment to run it. It is probably faster for me to delete them manually than figure out how to install and run it.

@Nilvus es, but this is even more tedious over just deleting the old filmrolls and re-discovering the them at the new place with a recursive import.

Really? I thought it would be easier

That is what the documentation says. After all, the script is a (unix/linux) shell script. so it needs its environment to run.

To fix this, the best way would be to allow for the selection of multiple items in the list of film rolls. This way, I could select all film rolls to delete and run the delete operation in one go.

1 Like

Since you mentioned MSYS2, I’m assuming you are on windows.

Another option is more nuclear that assumes a significant restructuring. 1) make sure your xmp are up to date, 2) organize the files in the tree structure you want, 3) rename your current database (library.db in C:/users/username/AppData/Local/darktable) to .old, 4) start darktable, 5) Add to Library (it would be a blank new library) all of the images in the new file tree structure.

@g-man Yes, this may be the best way. I did move most of my pictures (or directories with pictures within).
What would I lose this way ?

Edits and tags are in the xmp. So they are preserved. What about styles, presets, etc ?
How do I make sure my xmps are up to date ?

data.db holds the styles and stuff like that. Dont mess with that one.

In normal settings, the xmp should be up to date. You can select the all of images and then go to History stack and select Write sidecar files.

Potential issues: I think there are two. One is that you will lose the filmstrip collections. I call these: the group images I imported at one point in time. I dont find it useful in my workflow since I just use the folders as my navigation. The second issue is time. Importing does take some time if you have a large image set. More so, I think the cache will need to be regenerated. Regardless, you can quickly go back if you dont like the results. Just close dt, delete the new library and rename the .old to .db .

I use the scenario I described but in a slightly different way. I run darktable in fedora linux and windows. Both access the same images/xmp, but each have a different library due to the harddisk mounting location. One library doesnt know of the other one. I do have an extra step in the setup to check for xmp changes on startup to keep everything current and I do need to keep my darktable versions aligned since I run master.

Do all the film rolls share a common root folder that is also missing? In that case you can select the folders view in the collections module and search for the new location for the root. That will fix all childrens automatically.

I would love to be able to move collections in DT. It would be so powerful. However, I looked at the manual, I asked Dr Google and I explored DT itself. Please could you tell me how to move collections or even better, is there a way to move a folder of images from one location to another on the computer through DT?

Thanks in advance for your help.

Terry, that’s simple:

  1. go to a collection
  2. select all pictures of this collection (ctrl+a)
  3. use “move…” in “selected imaes[s]” lib module
  4. select the new location, possibly creating a new dir

That’s all. It will move all pictures in the new location and will remove the actual collection if empty (you don’t need to move all pictures at once, so you can split collections too).

Thanks, ladies and gentlemen !

In the end, I solved my problem by moving directories in the file explorer, re-importing recursively (yes, it took a while, but unattended), and then manually deleting the “dead” old collections (tedious).

However, I have learned that there are two databases (library.db and data.db). The library.db contains the same data as the sidecar files, so it can be deleted and recreated by importing all files. The data.db contains the rest of the settings, styles, etc. and should be left alone.

Thanks for this information. So easy once someone points me in the right direction. I presume there is no way to move a whole folder including the folder’s name. That could be a helpful feature.