asp.net遍历文件夹和文件

DirectoryInfo dir = new DirectoryInfo(Path);
foreach (DirectoryInfo df
in dir.GetDirectories())
{
if (df.ToString().Length != 18)
{
StreamWriter sw
= new StreamWriter(@"Paht",true,Encoding.UTF8);
sw.WriteLine(Path
+":"+df);
sw.
Close();
}
DirectoryInfo fdir
= new DirectoryInfo(Path+df+@"\");
// int i = 0;
if (!Directory.Exists(fdir.ToString()))
{
StreamWriter sw
= new StreamWriter(@"Path", true, Encoding.UTF8);
sw.WriteLine(Path
+ ":" + df);
sw.
Close();
}
foreach (FileInfo dChild
in fdir.GetFiles("*.swf"))
{
// i++;
}
}

 

posted @ 2010-11-04 18:16  comeonfyz  阅读(514)  评论(0编辑  收藏  举报