Delete the created directory/folder in C#

Posted by Saratvaddilli under C# category on | Points: 40 | Views : 1198
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


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

//Deletes the directory named "NewDir" which is just created above
Directory.Delete(directoryName); Console.WriteLine("Deleted: {0}", directoryName);

Comments or Responses

Login to post response