I had a bizarre situation when try to access the sub directories of my c: drive:
first I tried the following code, the output was 0 (zero):
MessageBox.Show(new DirectoryInfo("c:").GetDirectories().Length.ToString());
but when add '\' to path (c:), it showed the exact number of sub folders in c: drive.
MessageBox.Show(new DirectoryInfo("c:\\").GetDirectories().Length.ToString());
but tried a another drive (d:) like:
MessageBox.Show(new DirectoryInfo("d:").GetDirectories().Length.ToString());
it retrieves all the sub direcotories.
can anyone explain why is that happened?
Well thanks guys. Now I got the point just "c:" returns current directory not root "c:\". But I don't get any errors as bemused mentioned.