Deleting files managed by Folder Indexer plugin

Hello,

The Folder Indexer is a great plugin for looking at DICOM managed on disk by other programs like Osirix/Horos. Thanks for this useful tool!

When deleting files with the Rest API, it appears that the file is simply deleted from the Folder Indexer sqlite database - rather than deleting the physical file on disk. That’s understandable since I get the impression the Folder Indexer is really more of a read-only tool.

I’d like to be able to delete the file on disk using Orthanc along with the Folder Indexer. To that end, I could imagine writing a plugin or using the python plugin to intercept the Delete command and remove the physical file from disk prior to handing off to the Folder Indexer to delete it from the meta database. I could read the file’s location from the same database maintained by the Folder Indexer.

What I don’t know is where in the stack of events the Folder Indexer is inserted. If it manages to delete the file from the sqlite database before my own plugin can delete it from disk, then I won’t be able to use the Folder Indexer database to find the path on disk.

Given that the Folder Indexer is itself triggering after Rest API Deletes, I’m assuming that trigger has some sort of priority. How would I go about making sure my Delete took precedence?

Thanks,
John.