Which process is using a file?

  • Thread starter Thread starter DBC User
  • Start date Start date
D

DBC User

I would like know is it possible someway to find out which process is
holding a file using c#? I have a problem where one file is been held
by some process (I don't have a clue) and I want to force delete that
file with out stopping the application or restarting the computer. Is
it possible or am I day dreaming?

Thanks.
 
DBC User schreef:
I would like know is it possible someway to find out which process is
holding a file using c#? I have a problem where one file is been held
by some process (I don't have a clue) and I want to force delete that
file with out stopping the application or restarting the computer. Is
it possible or am I day dreaming?

I'm not sure if this helps you (because it's not a c# solution), but I
have sucessfully used http://ccollomb.free.fr/unlocker/
 
Hi,

It's not possible using a managed solution, you would have to P/invoke and
lot of it.

And even in case you can do it you will not be able to "tell" to the program
that has the file open to close it.
 
DBC User said:
I would like know is it possible someway to find out which process is
holding a file using c#? I have a problem where one file is been held
by some process (I don't have a clue) and I want to force delete that
file with out stopping the application or restarting the computer. Is
it possible or am I day dreaming?

Thanks.



There is no way to do this from user code (any language), and doing it from
kernel space means writing a filter driver.
Now, even if you could get at the owning process, how do you think that
process will behave if you start deleting it's files?

Willy.
 
Back
Top