【发布时间】:2011-06-07 05:14:28
【问题描述】:
我遇到了问题。
我的问题是读取给定目标中包含主文件的所有子目录。
我可以读取子目录,但我正在创建一个只读取给定目录的项目,该目录应该包含目录中的主文件。
在给定的目录中应该有一个名为 Master 文件的文件。
我想编写代码,如果给定目录中不包含任何主文件,它应该跳转到另一个目录。
我的源目录是@"C:\test.
在@"C:\test" 中有很多文件夹和子文件夹。
测试目录包含 "C:\test\test1\test2\test3 。在此路径中 test3 文件夹包含主文件 test1 而 test2 没有。
我想把这段代码写成这样,
MLMReader Reader = new MLMReader();
Reader.OpenDirectory(@"C:\test");
if (!File.Exists(test + "\\Master"))
{
//i want to loop the "C"\\" and if test1 does not contain
// Master File then jump to another directory test2, if
//test2 directory contain Master File then the work should
// continue after finishing go to test3
}
有什么办法吗。 对我的问题有任何建议。
【问题讨论】:
标签: c#