C# Program to Demonstrate the Use of Createsubdirectory Method

You are currently viewing C# Program to Demonstrate the Use of Createsubdirectory Method

C# program to demonstrate the use of CreateSubdirectory method

using System;
using System.IO;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main()
        {
            DirectoryInfo d = new DirectoryInfo("mydir");

            d.CreateSubdirectory("sub-dir");

            Console.WriteLine("Sub-Directory created successfully");
            
        }
    }
}

Output

Sub-Directory created successfully.

Ranjith Kumar

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply