File deletion question

Mothra

Well-known member
Joined
Nov 26, 2002
Messages
173
Location
Fresno, California
Is there a way to "force" a file to be deleted even if it is "...being used by another process."? I have tried both of these methods:

Code:
File.Delete(myFile)
and
Kill(myFile)

I am closing all file and/or memory streams that opened the file origionally but it does not seem to have any effect on my ability to delete it. Am I missing something??
 
If its being used by another process the process has to be aborted first. There is no way around it. What is the file?
 
Its just an xml file. Once Im done processing the information in it, I dont need it anymore so Id like to discard it altogether. Is there a way to find out what process has it and then abort that process?

p.s. I like your avitar! ;)
 
yeah this avatar has really gotton around; not sure where it started...had it forever now as Im sure you have too...
 
Just noticed something strange about it as well, I will normally have multiple files in the directory to be deleted but, if there is only one file in the directory, it works just fine. Once there is a second file there, the first file causes an exception...very strange. Ill check out that process explorer though, thanks!
 
Back
Top