Clean up orphaned XMP files

I’m doing a deep dive of my older files and found that I have a lot of orphaned XMP files that were attached to raw files that I’ve deleted. Can someone suggest how to clean them out?

I will probably need a lot of step by step directions if I have to go command line.

I’m running DT 5.0 on Windows 11.

Many thanks

This sparks some ideas to me using a Bash script, although it would most likely need a WSL with something like Ubuntu, which I’m not sure if sure you are familiar with.

Some time ago, I wanted to do something similar for JPEGs that had a pair with a RAW, and keep those that were in-camera edits (named slightly differently I think, and therefore not paired).

1 Like

It’s an interesting problem. My orphaned XMPs don’t take a large amount of space, but I’d like to clear them out anyway.

So… do you have any experience with Bash, or even better … do you have a WSL Ubuntu available?

I didn’t look in too deep but last night I just did a simple Google search and there were a few proposed scripts to do this… I think one was on a thread in the DPreview website

maybe ask chatGPT for a script. Just specify, how to determine orphans and it will generate a proper script (better let it create an additional verbose only mode, so you can check the result before running the delete mode)

Yeah, when my script is supposed to delete stuff, I replace rm with ls and test it.

2 Likes

I’m very loathe to ask GPT about anything! But I hear tell that folks do get valid results that cut down program typing time. Once fairly fluent in shell, my brain cells are now so dim that I feel like a beginner again. Maybe I should try it.

My top-level culling is going through the camera JPGs, deleting the rejects, and running a script that looks for raw files without a JPG and deletes them. But that’s in one directory, so I don’t think it uses find which is the key to multi-directory/recursive stuff.

Before we go too deep into Linux/Unix scripts, OP specifies “windows-11”.
Not sure Bash or equivalent is available there…

should be pretty trivial to do in powershell :wink:

1 Like

Ahh… Yes, true.

I thought there was a Linux-under-windows thing. Some sort of thing. I seem to remember seeing something like Unix utilities for Windows, but it was a looong time ago.

Yes, I did say Windows but if the idea helps under Linux then hopefully it’ll work its way over.

1 Like