I want to get the total count of tmp files in c drive. it shows error. Below mentioned is the code which I have use.
fileCount = Directory.GetFiles(@"C:\\", "*.tmp", SearchOption.AllDirectories).Length;
when I run this it shows access denied error.
c:\system volume information is access denied.
please resolve the same.
Access denied error
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Poppa Wallace97 reputationPosted Nov 27, 2012, 12:33 PM EST
var count = Directory.GetFiles(@"c:\\")
.Count(p => Path.GetExtension(p) != ".tmp");
MessageBox.Show(count.ToString());
Thats all I can suggest
Jay
Vithal WadjeRank #19 · 47.2K reputationPosted Nov 27, 2012, 6:00 PM EST