从输入路径获取第N个子目录的文件 [英] Getting Nth sub-directory's files from an input path

查看:78
本文介绍了从输入路径获取第N个子目录的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用C#从输入目录的第n个子目录中获取文件.

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

推荐答案

这是我完成的解决方案.及其工作.

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是第n个孩子,方法sub_dir(string)是

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;
        }

这将转到每个输入目录的第n个子目录..检查一下.

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

这篇关于从输入路径获取第N个子目录的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆