What's the best way to delete read-only files?

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

Guest

Using VB .NET 2003, I need to delete some read-only files.
I tried using System.IO.File.Delete(filename) - but when the files are
read-only, I get error messages stating that I don't have proper access...

So, what's the best way to delete a read-only file programmatically?

Any help would be greatly appreciated!
 
There's probably another way, but how about:

System.IO.File.SetAttributes("C:\test.txt", IO.FileAttributes.Normal)

Then delete...?

Jay Taplin, MCP
 
Back
Top