I have listed all directories in a folder in a listbox.
private void Form1_Load_1(object sender, EventArgs e)
{
listBox3.Items.Clear();
string[] dirs = Directory.GetDirectories("C:\\Users\\foo\\Desktop\\test");
foreach (string dir in dirs)
{
listBox3.Items.Add(dir);
}
}
How can I list the subdirectories as well? As if it were the command "tree" of the windows command prompt. thanks
Copyright Notice:Content Author:「I love Code」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/45244389/use-listbox-items-in-function-c-sharp