且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何查找一个particulr文件夹中有多少个文件

更新时间:2023-11-08 19:46:34

使用System.IO.Directory.GetFiles.请参阅 http://msdn.microsoft.com/en-us/library/system.io .directory.aspx [ ^ ].

—SA
Use System.IO.Directory.GetFiles. See http://msdn.microsoft.com/en-us/library/system.io.directory.aspx[^].

—SA


尝试:
string[] files = Directory.GetFiles(path);
Console.WriteLine(files.Length);


HI,
以下是简单的方法及其工作方式:


following is the simple way and its working:

System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo(Server.MapPath(folderName));







if (dirInfo.Exists)
            {
int fileCount=dirInfo.GetFiles("*.*").Count()

}




如果它有效,请回复我.::)




Reply me if its working.... : )