Create a directory or folder using C#

Saratvaddilli
Posted by Saratvaddilli under C# category on | Points: 40 | Views : 883
using System;

using System.IO;

namespace ConsoleApplication1

{

class Program

{

static void Main(string[] args)

{

string directoryName = Directory.GetCurrentDirectory() + @"\NewDir";

//Creates a new directory named "NewDir" within the current directory

Directory.CreateDirectory(directoryName);

Console.WriteLine("Created: {0}", directoryName);
}
}
}

Comments or Responses

Login to post response