5 Answers
5

There are multiple reasons why a file deletion would fail. For instance if another process is holding a handle to it, or if you don't have permissions to delete this file. In both scenarios you will be able to check the file for existence, but not to delete it.

There are many reasons why a file can't be deleted. The most likely ones are that the file is open in another process or that your process has launched with less privileges than those required to delete that file.