I'm trying to "force delete" a directory, meaning I need to delete the directory even if it is locked by a process. I don't think this is however possible but is it possible to find out which process is locking the file, then terminate that process?
I'm trying to get this done but I can't find anything online - at least in Java.
I tried it and I just got "The process cannot access the file because it is being used by another process".
The line of code I'm using to delete it right now (using Apache Commons IO):
FileUtils.forceDelete(file);
Can anyone help?