Check folder exists and create if not in C#

Updated on     Kisan Patel

This tutorial will show you how to create a directory in the drive using C#.

Using CreateDirectory method of Directory class we can build a directories that are described in a path as a parameter.

NAMESPACE:

using System.IO;

CODE:

if(!Directory.Exists(path))
{
     Directory.CreateDirectory(path);
}
else
{
     //Directory is exists...
}

C#

Leave a Reply