string dir = @"C:\test"; // If directory does not exist, create it if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); }