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,560
  • 14
  • 57
  • 79
Yanshof
  • 9,297
  • 18
  • 86
  • 178

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
  • 469
  • 4
  • 13
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
  • 181
  • 6