how to create file directory

Alok_niit
Posted by Alok_niit under C# category on | Points: 40 | Views : 1908
it will create directory named alok2.txt in D:

//create directory
 using System;
using System.IO;
public class A
{
public static void Main(String[] args)
{
DirectoryInfo df = new DirectoryInfo("D://alok2.Txt");
if (df.Exists)
{
Console.WriteLine("the Directory is exist");
}
else
{
Console.WriteLine("the Directory does not exist");
df.Create();
Console.WriteLine("the file is created");

}
}
}

Comments or Responses

Login to post response