I want to list all the folders and their subfolders and theirs till reaching to deepest folder.
I have written a method like this:
public void scanFolders(string path)
{
foreach (var dir in new DirectoryInfo(path).GetDirectories("*", SearchOption.AllDirectories))
{
listBox_Folders.Items.Add(dir.Name);
}
}
This brings me all the folders and subfolders. It is OK
But I need a little different solution. I want to list subfolders of a folder just beneath its parent starting with a hyphen (-).
It should look like
<select>
<option>folder1</option>
<option>-subfolder11</option>
<option>folder2</option>
<option>-subfolder21</option>
<option>-subfolder22</option>
</select>
What I have is
<select>
<option>folder1</option>
<option>folder2</option>
<option>subfolder11</option>
<option>subfolder21</option>
<option>subfolder22</option>
</select>