The following code illustrates on how to check if directory exists in specific path, if not then create directory.
Here I show that how to create the directory with simple condition.
private void TestDirectory()
{
string pathname = “C:\\Myfolder”;
if(!Directory.Exists(pathname))
{
Directory.CreateDirectory(pathname);
}
}