using System.IO;
// Unterverzeichnisse und Dateien von "c:\" lesen
DirectoryInfo diCurrentDir = new DirectoryInfo(@"c:\");
DirectoryInfo[] diaSubDirs = diCurrentDir.GetDirectories("*.*");
FileInfo[] fiaFiles = diCurrentDir.GetFiles("*.*");
// Unterverzeichnisse
foreach (DirectoryInfo diDir in diaSubDirs)
{
string sDirName = diDir.Name;
string sDirAttr = diDir.Attributes.ToString();
}
// Dateien
foreach (FileInfo fiFile in fiaFiles)
{
string sFileName = fiFile.Name;
string sFileLength = fiFile.Length.ToString("N0");
string sFileAttr = fiFile.Attributes.ToString();
}