1.使用.Net遍历指定目录下的所有文件
方法:
private void
所有分类 Asp.Net C# Database Web Service XML 其他
  • 设计模式 GetFiles(string path)
    {
        //获取当前目录下的所有文件并显示
        string[] files=System.IO.Directory.GetFiles(path);
        foreach(string s in files)
        {
             Response.Write(s+"<br>");
        }
        //获取当前目录下的所有子目录并进新递归调用
        string[] dir=System.IO.Directory.GetDirectories(path);
        foreach(string s in dir)
        {
             this.GetFiles(s);
        }
    }
  • 调用:GetFiles(@"E:\");
  • 相关文章:

    • 2021-05-29
    • 2021-07-05
    • 2022-12-23
    • 2022-12-23
    • 2022-12-23
    • 2022-02-08
    • 2021-11-13
    • 2021-06-14
    猜你喜欢
    • 2021-08-29
    • 2021-06-17
    • 2021-06-04
    • 2021-12-23
    • 2021-08-30
    • 2022-01-07
    • 2021-11-15
    相关资源
    相似解决方案