I have photos I’ve edited with Darktable that have produced xmp side car files.
Like:
./Taiwan/DSC01929.ARW
./Taiwan/DSC01929.ARW.xmp
I am trying to organize my photos into dated folders like, “2025/01/20/Taiwan/DSC01929.ARW”
I need the xmp files to go with them to preserve those edits. So far I haven’t been able to get exiftool or Digikam to recognize and bring those with the images.
Any help is appreciated.
EDIT
If using Digikam, pay particular attention to the metadata options:
The default filename for sidecars is automatically set to filename.ext.xmp. For example, image1.dng will have a sidecar file named image1.dng.xmp. If the Sidecar file names are compatible with commercial programs option is enabled, digiKam will instead create the XMP sidecar files with a compatible file name (image1.xmp) used by many commercial programs.
XnView MP has an excellent search engine which can find files like that, present them and only them as a ‘contact sheet’ from which you can save them anywhere you like.
Thank you @cedric for the recommendation. I installed it and it does indeed have a great search that considers the xmp file, but not any way to organize them into folders, only batch rename the files.
I think exiftool can do what I’m trying to do, I just haven’t found the right combination of options.
There is a move or copy option in DT’s lighttable view which is very handy for moving a small number of images to reorganise them, but this is probably unsuited to handling a large numer of images from various dates.
Or have a look at digikam, it allows you to create albums and move images around (albums equate subdirectories on disk in digikam). XMP files are moved with the images, in principle: I do not know what happens if you created duplicates in darktable…
But be careful with any way to move images around outside a program that doesn’t use sidecar files. If you use e.g. a script or a file manager, it is your responsability to keep sidecars with their images.
This is of course not an issue when you move complete directories around, where images and sidecars always stay together.
In any case, you’ll have to re-import your whole collection again in dt, unless you use dt to do the moving.
I use the following bash script (you did not state your operating system, but you can even get it for Windows, or probably ask an LLM to convert it to Powershell) to rename files.
This takes the images with the specified extensions, extracts the date, and creates mv (move) commands to rename the files. You could alter it to create a directory instead, and move the files there. Currently, it creates commands like this:
I never got deep into substitution in variables, but just to throw in the idea, this is useful when dealing, for instance, with jpg and raw, etc file pairs. For instance, this is my first-cull script before importing what’s left into dt.
for i in *.ARW
do
fname=${i%.ARW}
if [ ! -f ${fname}.JPG ]
then
rm ${fname}.*
fi
done
I’ve deleted jpgs, so it looks for ARWs that don’t have a JPG (culled) and removes all files with that name and any extension.
Your script goes deep with the exiv stuff. I’ve never used that in scripts. Maybe one day
(Back in the (work) day, I was a big fan and user of awk)
Are you using the XMP naming scheme (<name>.ARW.xmp) used by both darktable and digikam? In that case, it would not only be surprising, but a serious bug.
If the failure to move sidecars concerns duplicates from darktable (<name>_<n>.ARW.xmp) I’m less surprised (I more or less expect those to be ignored, as digikam doesn’t use such sidecars).
The default filename for sidecars is automatically set to filename.ext.xmp. For example, image1.dng will have a sidecar file named image1.dng.xmp. If the Sidecar file names are compatible with commercial programs option is enabled, digiKam will instead create the XMP sidecar files with a compatible file name (image1.xmp) used by many commercial programs.
The left behind xmp files are named like image1.xmp. I will either need to rename them (probably some exiftool conversion to ensure the correct raw format extension is used) or toggle that checkbox on and deal with the image1.ARW.xmp files, which there are fewer of.
So you have both filename.ext.xmp files and filename.xmp files?
If that’s your issue it’s pretty damn hard to solve it without loosing data. Unfortunately it’s a design decision made by DT devs and they won’t budge. All users have to know about the issue and how to avoid it before using DT otherwise they will end up with multiple .xmp files that you can’t realistically merge.
Erm, I don’t have that option. I can pick either “Add to library” or “Copy & import”.
“Add to library” does just that, add existing images to the library without any moving or copying. But it does read existing sidecar files.
“Copy & import” does not read existing sidecars, according to the manual:
Which is why the suggestions are to move the files within darktable, where the files are already in the darktable database, or to use an external tool and accept the responsability to move image and sidecar together…
In the browse view, select the files you want to move to any folder, then right-click and select ‘Copy To …’. In the ensuing dialog you can enter an existing folder or create a new one.