I'm stuck at this problem I would really appreciate if someone can help me solve this problem.
- I want to add spaces for sub-folder like this format down below.(it must be done with recursion)
I want to add spaces for sub-folder like this format down below.(it must be done with recursion)
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.IO; namespace G14_211115 { class Program { static void Main(string[] args) { string path = @"C:\Program Files\FinchVPN"; WriteDirectories(path); Console.ReadKey(); } /* Tasks. * 1. I want to add spaces for subfolder like this format down below. ( it must be done with recursion) * Like this * -------------------------------------------------------------- * Folder 1 * Folder 1.1 * Folder 1.2 * Folder 2 * Folder 2.1 * Folder 2.1.1 * Folder 2.2 * Folder 3 * Folder 4 * * 2. Task 2 I want to retype this code without using recurrence and C# inbuilt functions. */ static void WriteDirectories(string path) { string[] dirs = Directory.GetDirectories(path); for(int i = 0; i < dirs.Length; i++) { Console.WriteLine(dirs[i]); WriteDirectories(dirs[i]); } } } }