Search This Blog

Tuesday, January 21, 2014

Creates directory C# example

C# > Files > Directory > CreateDirectory

Creates directory  in the specified path.

Example:

 

string dir = @"c:\dir1";
try
{
            if (!Directory.Exists(dir))
      {
              DirectoryInfo di = Directory.CreateDirectory(dir);
      }
}
catch (Exception ex)
{
       MessageBox.Show(ex.ToString());
}
finally {}