Removing a file

  • Thread starter Thread starter K Viltersten
  • Start date Start date
K

K Viltersten

I need to remove a file.

That's the short story. :)

I go, of course, File.Delete(path) but the
problem is that it's being locked by an
other program. I wonder if there's a way
to brutally remove the file anyway. Any
means is feasible.

Thanks!
 
I need to remove a file.

That's the short story. :)

I go, of course, File.Delete(path) but the
problem is that it's being locked by an
other program. I wonder if there's a way
to brutally remove the file anyway. Any
means is feasible.

I'm sure you'll need to drop into unmanaged API calls to call down the Great
Sledgehammer and close any handles that are open against the file. I know it
can be done; Process Monitor does it, as do some other freeware tools like
Unlocker.
 
I need to remove a file.

That's the short story.   :)

I go, of course, File.Delete(path) but the
problem is that it's being locked by an
other program. I wonder if there's a way
to brutally remove the file anyway. Any
means is feasible.

Hi,

AFAIK it is not possible, for sure you have nothing in the framework
for that, you would have to go unmanaged. an even there I do not know
if there is such a tool. I mean if the file is opened by other process
must be because it's using it. What would happen in the other process
when it try to access the file and the file is gone?
 
message
AFAIK it is not possible, for sure you have nothing in the framework
for that, you would have to go unmanaged. an even there I do not know
if there is such a tool. I mean if the file is opened by other process
must be because it's using it. What would happen in the other process
when it try to access the file and the file is gone?

More than likely: boom!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top