Delete orphan xmp files

If I have this files
a.jpg
a.xmp
b.cr2
b xmp
c.cr2
c.jpg
c xmp
d.xmp
I wont to delete all xmp that has no jpg or cr2 files
in the files above it's only "d.xmp that should be deleted
I need to check more then 30.000 files need to go down at least 3 levels
all files are in a number of subfolers
Is this something that kan be done easy in Dopus?

Sven Åke
os win8.1 x64
Dopus 11.5.3

Maybe it is not "easy" but it can be done :smiley:

The attached script adds a custom column "OrphanedXMP" to DOpus.
It checks if xmp files have .jpg, .dng, or .cr2 files in the same directory with the same name.
If no file is found, the column is set to "orphaned".

You could use the column within the DOpus advanced find function to easily get all the orphaned .xmps.

If you want to change the extensions to check for, or add more (maybe .nef?) you could extract the .js file from the osp (it is just a renamed .zip file) and edit it.

The relevant checks are in line 45-50 and should be easy to change/extend, even without further knowledge of .js.

I have done only some rough testing, so be a bit careful before deleting your files and do some tests on your own.
OrphanedXMP.osp (2.18 KB)

Thanks I will look on this later
If I have questions I came back here

Sven Åke

Nicely done, Miran! I had just started writing something very similar, but you beat me to it. :slight_smile:

One thing I was going to mention is that a column like this may show incorrect results when you copy new files to a folder, or similar. For example, if you copy a new .XMP file into an empty folder, and the column is refreshed for that new file, it will say the file is an orphan (since it is). If you then copy the corresponding .jpg into the folder, the column will refresh for that .JPG file, but not for the .XMP file, unless you force a refresh in some way (e.g. push F5).

This shouldn't be a problem when using the Find Files panel (unless you're searching for things as you move data around, which would be a bad idea obviously). Just something to keep in mind if you use the column in your main file display for everyday stuff. (And on that note, you could set up a label-filter to e.g. highlight orphaned files in red, or similar, if you wanted to.)

[quote="leo"]Nicely done, Miran! I had just started writing something very similar, but you beat me to it. :slight_smile:
[/quote]
Strike :slight_smile:

Probably my starting point was way better than yours, as I had a very similar (check if cr2 file has a corresponding .dng file) script already in use since the new custom column feature was released :wink:

At last time for testing
But as you see on screen shot is given some false "orphan" then file extension is *.CR2.dop
it's also missing some real "orphan" for example IMG_0020.XMP and IMG_0021.XMP

How can do this in sub folders, as it's now I need to go down in every sub folders
I have normally as average 30-50 files per folder(30000 image)

Sven Åke


Where do those .cr2.dop files come from? This is the first time ".dop" has been mentioned in the thread.

.dop files is DXO raw converter

sorry I did not have them in my test folder, so I forget it

Sven Åke

Try the updated Version. again, not really tested, but should fix the problems you have found.
OrphanedXMP.osp (906 Bytes)

Use DOpus Flat File View or DOpus search with the custom column include subdirs.

Sorry but now is NO files marked as orphan in same test folder

Sven Åke

argl the extension check is case sensitive and I only covered lowercase while in your case everything seems uppercase.

a version with case insensitive extension check.

OrphanedXMP.osp (917 Bytes)

Now it's look as it's okey in my test folder
I will test more

TANKS!
Now it's time to read more on this

Sven Åke