Sunday, May 13, 2007

Directory.GetDirectories without getting Unauthorized errors

foreach (string dir in Directory.GetDirectories(@"c:\"))
{
DirectoryInfo di = new DirectoryInfo(dir);
if ((di.Attributes & FileAttributes.System) == 0)
dirList.Add(dir);
}

DirectoryInfo.Attributes is a Flag enum list so you can't just check for equality. Using the above code makes it more or less safe :-)

Lazzes Smart Home - 2023

Here is an overview of the components in the Smart Home as of now. More stuff than I tought :-)