System.IO.IOException: because it is being used by another proces

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When i was trying to recursively delete a directory:

Directory.Delete(mydirectory,true);

It threw the following exception for a lot of files:

System.IO.IOException: The process cannot access the file "abc.xsl" because
it is being used by another process.

Upon further examincation, it is found that these files are all zero-byte
empty files.

Someone suggested that it might be caused by aggressive AV programs, so i
disabled AV on the box and retried, but still got the same errors.

Any clue on what might be the problem? It is running .NET 1.1 on Windows
2003 standard edition.

Thanks!
 
maybe they are in a network shared directory? and windows simply lost count
of how many network user are usin it!
try reboot!
 
Hello Lloyd,

I believe that Windows will not allow you to delete a file if that file is
accessed by someone.
Does the code work on a directory without files? If it does not work on any
directory, then maybe there is something wrong with the code.

Help this helps :),
Alex.
 
Back
Top