TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
khalid Johnson
NA
9
0
Looping a directory with subdirectories?
Oct 5 2007 11:59 AM
I am working on a windows application in VS2005 C#. The problem is that I will read a directory for files. I have a foreach so I can loop al the files in the directory. Know I wil do the same but for the subdirectories also. So I think there must be a second foreach and place the subdir in the method. Someone who can help me??
Here is some test code:
public void test(String path)
{
DirectoryInfo root = new DirectoryInfo(path);
DirectoryInfo[] dirs = root.GetDirectories();
String bla = "";
foreach (DirectoryInfo subDir in dirs)
{
bla += subDir.Name.ToString()+"-----";
}
richTextBox1.Text = bla;
}
Reply
Answers (
3
)
generate xml file based on xsd and data
C#: For Loop & 2 Arrays