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?
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)
Nicely done, Miran! I had just started writing something very similar, but you beat me to it.
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.
[/quote]
Strike
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
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)