I have a garbage catalog in which I upload downloads, one-time projects, drafts and other various things that can be useful for several days, but they do not need to be saved forever. To prevent this directory from intercepting my computer, I wrote a program that will delete all files older than the specified number of days and register some statistics about the number of deleted files and their size just for fun.
I noticed that several project folders live much longer than necessary, so I began to research. In particular, it seemed that the folders for the projects in which I used SVN were sticking around. It turns out that the read-only files in the .svn directories are not deleted. I just did a simple test in a read-only file and found that System.IO.File.Delete and System.IO.FileInfo.Delete would not delete the read-only file.
I do not need to protect files in this particular directory; if something important in it is in the wrong place. Is there a .NET class that can delete read-only files, or will I have to check read-only attributes and erase them?
OwenP Nov 05 '08 at 17:13 2008-11-05 17:13
source share