How to change this recursive loop with non recursive? I know this method is easy way but i'm interested in non recursive way of this solution.
using System;
using System.IO;
namespace NonRecursion {
    class NonRecursion {
        static void Main() {
            string createPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string getPath = createPath + @"\folder";
            GetDirsPath(getPath);
            Console.ReadKey();
        }
        static void GetDirsPath(string getPath) {
            string[] dirs = Directory.GetDirectories(getPath);
            for (int i = 0; i < dirs.Length; i++) {
                Console.WriteLine(dirs[i]);
                GetDirsPath(dirs[i]);
            }
        }
    }
}
Can i change only this function?
static void GetDirsPath(string getPath) {
            string[] dirs = Directory.GetDirectories(getPath);
            for (int i = 0; i < dirs.Length; i++) {
                Console.WriteLine(dirs[i]);
                GetDirsPath(dirs[i]);
            }
        }
 
     
    