C# Program to create new directories


Use the CreateDirectory method to create a directory.

Let’s say you need to create a directory in D drive. For that, use the CreateDirectory() method as shown below −

Directory.CreateDirectory("D:\Tutorial");

The following is the code −

Example

using System.IO;
using System;
public class Program {
   public static void Main() {
      Directory.CreateDirectory("D:\Tutorial");
   }
}

karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know

Updated on: 22-Jun-2020

80 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements