How do I know the number of folders inside a directory?
I try using System.IO.Directory but no luck.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’ve got a couple of options:
or
If you need to do other things with them, and you’re using .NET 4, you can use the DirectoryInfo.EnumerateDirectories() function for performance reasons as well.
So yeah, lots of options. If you’re still having problems, you might want to let us know what didn’t work when using System.IO.Directory.