0

I'm trying to delete some file on my code. But I get an io exception and a message of

"the process cannot access the file because it is being used by another process"

Is there some way to know which process hold a handle to this file?

SurvivalMachine
  • 7,946
  • 15
  • 57
  • 87
Yanshof
  • 9,659
  • 21
  • 95
  • 195

2 Answers2

0

Use something like the following application to query which process has a handle on the files you are trying to delete.

Microsoft Sysinternals Process Explorer

Anthony Sherratt
  • 479
  • 4
  • 14
0

If you want to check this from your code then you can use handle.exe https://technet.microsoft.com/en-us/sysinternals/bb896655.aspx And you will find example on how to use it in Gennadys answer here: How do I find out which process is locking a file using .NET?

Community
  • 1
  • 1
Eric Linde
  • 191
  • 6