For some reason, you cannot retrieve the total size of a directory in .NET, including subdirectories, without a workaround. I always found it odd, that some of the most basic features is not implemented in the .NET CLR by default. The list is very short though, since the CLR is huge. I already wrote about the missing Visual Basic functions in C#. Here is another little helpful method that returns the total size of a directory in bytes

private double size = 0;

private double GetDirectorySize(string directory)
{
    foreach (string dir in Directory.GetDirectories(directory))
    {
        GetDirectorySize(dir);
    }

    foreach (FileInfo file in new DirectoryInfo(directory).GetFiles())
    {
        size += file.Length;
    }

    return size;
}

You can then call this method like any other. In ASP.NET you might want to write it to the response stream like this:

Response.Write(this.GetDirectorySize(@"C:\websites\dotnetslave"));

My boss bought the DVD Aardvark'd from Joel Spolsky’s company Fog Creek. It’s about the development process of a software product, and it was meant to be an inspiration for us developers. I watched the whole thing with English subtitles, because the sound was so poor. Man, it was boring. I thought it was all about software and development and the .NET Framework. I was so wrong. It was a reality show about some college guys living and growing tomatoes together. Sure, there was some techno babble, but not near enough considering it’s a development video.

Today, I just found the newest episode of The Code Room. This is much more interesting than Aardvark'd. The latest episode, “Las Vegas”, is however a little over produced. Nevertheless, the show contains much more techno babble and useful information.

I have followed The Code Room from the first episode about a year ago, and I don’t understand why it isn’t bigger and more supported than it is. It’s the first software development TV show, it’s .NET and it’s Microsoft. Episode two is my favourite episode. Go check it out.