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");
   }
}
Updated on: 2020-06-22T14:34:54+05:30

147 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements