Articles → .NET → Get the list of all folders on a given path using C#

Get the list of all folders on a given path using C#






Path





Click to Enlarge


Code


using System;
using System.IO;

namespace TestApp
{
    class Program
    {
        static void Main(string[] args)
        {
            DirectoryInfo di = new DirectoryInfo(@"complete_path");
            foreach(DirectoryInfo d in di.GetDirectories())
            {
                Console.WriteLine(d.Name);
            }
            Console.Read();
        }
    }
}



Output



Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Monday, June 05, 2017

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250