Get the directories

Posted by Venkat | Labels:

Here is the code how to get all directories and save them to a List:


//Path with all directories in

String Path = Server.MapPath("Folder1\\"); //Declare List

List<String> GetThreads = new List<String>();

//Get all direcotories

System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(Path);

foreach (System.IO.DirectoryInfo file in dir.GetDirectories())

{

//This saves all Direcory names like "Folder1", "Folder2", "Folder3", "Folder4";

GetThreads.Add(file.Name);

}

0 comments:

Post a Comment

Thanks for the Comments.

PayOffers.in