Getting Nth sub-directory's files from an inpu

2019-09-30 07:41发布

How can i Get Files from nth sub-directory of an input Directory using C#.

1条回答
beautiful°
2楼-- · 2019-09-30 08:45

here is the solution i have done . and its working .

foreach(var dir in Input_Folders)
        {
            string f = dir;

            for (int i = 0; i <= n; i++)
            {

                string path = sub_dir(f);
                f = path;
            }
} 

n is the nth child and the method sub_dir(string) is

public string sub_dir(string path)
        {

            string[] direct = Directory.GetDirectories(path);
            string s = direct[0];
            return s;
        }

this will go to the nth child of the each input directory .. check this out .

查看更多
登录 后发表回答