Thanks for taking care of this topic. We’ve also noticed that this methods lefts export files that will stay on the server and cannot be flushed by Mobile.Sdk. Or at least I don’t know how to do it. And it’s troubling as we need to keep track of them or we’ll quickly reach limits.
Desired funcionality (“option to check if there are any leftovers from previous runs and flush them”) does not exist. Investigations are just not designed as a single-instance thing. Instead - customers usually want to have various different investigations and keep them for a while.
What I can recommend is to make a one-time modification in your settings, to enable retention policy. You can do that from Management Client → Mobile Server → Investigations:
To try address your other issue (leftover files), you can observe how Web Client deletes investigations (Browser → F12 → Network tab → Playload). I just made sure that C:\ProgramData\Milestone\XProtect Mobile Server\Exports only contains a couple of empty folders after deleting all investigations via Web Client.
Mobile SDK should behave quite the same. Mobile Client and Web Client rely on it internally.