How to delete all XMP with no edits

I’m learning DT on 3.6 and now 3.8 series.

I noticed every image I imported has the companion XMP. This seems unnecessary. I take way more photos than I edit. So I’m deleting more than editing. OOTB, DT’s preference is to create the XMP on import. I’m curious why that’s the default.

I changed my preference to write the sidecar file after edit.

However, there is the issue of all of these XMP files that exist which don’t have edits. Not sure how to find them and delete them.

Does “select untouched” in the select module pick the XMP or the original? Or does that depend on whether the XMP exists or not? Would I use remove or delete?

Prior to version 3.8 darktable only allowed you to create XMPs or not (boolean option) and, with the default (do create), XMPs were created immediately. On the introduction of additional options, we normally try to keep the default behaviour unchanged, which in this case means “create on import”. That’s not to say we couldn’t change it though.

1 Like

How is the ‘check for modified xmp on start’ option handled when the xmp is created only after edit? Or what happens if the xmp is created externally after darktable imports but before edits?

No idea (I don’t use it). You could test and see.

https://docs.darktable.org/usermanual/3.8/en/preferences-settings/storage/

" after edit: An XMP file will be written the first time you perform an edit on an image and will be updated on each subsequent edit. Importing will not generate an XMP file by default"

dt behaves exactly as the manual tells you :slight_smile:

About your questions:

  1. There is a hash written to the dt database after import as a reference. So dt knows when you do an edit.
  2. If you create the xmp by any other way, dt does not know and doesn’t care.

@hannoschwalm, I’m interested in being able to delete all the existing XMP, without edits, created during import in 3.6 and 3.8 with on import set.

How many images…I suppose removing all images that are tagged as unmodified and then importing them back in with the new after edit settings might achieve this.

I would just test and be careful…

It happens here and then that I have a large number (1000s) of XPM in the folder. I delete all 1Kb files created on the same day manually.
I believe also a minor edits will push the size >1Kb (I haven’t tested that though).

Removing an image from the database must not remove the sidecar for security.

Removing sidecars from unmodified images could be done via a lua script.