Often we need to ensure a Directory exists before we reference or use it. This is a little method that does this for you. Nothing complicated, but if you need to check that 2 or more directories exist, this will save you lines of code:
private static void EnsureDirectoryExists(string dir) { if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } }
