Click here to Skip to main content
15,915,336 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am searching for a method to list out all directories names along with sub directories. I have around 2000+ directories with sub directories within then. I just need the directory names with their full path. The files within then are not needed at this moment. I am basically trying to create a tree view from this.The standard method of .net seems very slow in fetching. Takes around 6 secs to get the list.

Thanks.

What I have tried:

The standard method

List<string> dirs = new List<string>(Directory.EnumerateDirectories(DirectoryPath,"*",SearchOption.AllDirectories));
Posted
Updated 17-Jun-16 2:28am

Are you populating the tree control with all of this information at the same time?

You really don't have to. All you do is populate the top level of the tree. You then give every node a "dummy" node under it so you get the "+" to expand it. When the user clicks that node to expand, you remove the dummy node and go get all the folders immediately under that node and populate them. That doesn't take any time at all.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900