This is what I've done so far:
class Program
{
static void Main(string[] args)
{
DirectoryInfo startDirectory = new DirectoryInfo(@"C:\Users\Angelo\Desktop\ExerciseTest");
string output = "";
DirectoryInfo[] subDirectoryes = startDirectory.GetDirectories();
for (int i = 0; i < subDirectoryes.Length; i++)
{
output = output + subDirectoryes[i].ToString() + "\r\n";
}
Console.WriteLine(output);
Console.ReadLine();
}
}
This gives me as a result the first subfolders of the specified folder, the problem is that I need to find all the subfolders,subsubfolders,subsubsubfolders etc.. and files in the specified folder, and then output them with this indentation:
- Subfolder1
- SubSubfolder1
- SubSubSubfolder1
- SubSubfolderFile1
- SubSubfolder2
- SubSubfolder1
- Subfolder2
- SubfolderFile1
I've been trying to do it many times but I can't figure out how, maybe I'm missing some command (this is the first time I program with c# System.IO) can you please give me some tips or tell me what commands I should use? I'm going crazy.