如何查找一个particulr文件夹中有多少个文件 [英] How to fin the how many files are there in one particulr folder

查看:58
本文介绍了如何查找一个particulr文件夹中有多少个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在使用智能设备应用程序.使用Web服务会生成x ml文件.我想如何确定一个特定文件夹中有多少个文件,以及如何确定在设备应用程序中使用的c#.net中一个特定文件中有多少个图像?

Hi, I am working in smart device applications.using web services generate x ml files. I want how to identify the how many files are there in one particular folder and ,how to identify how many images are there in one particular file in c#.net using in device applications?

推荐答案

使用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.... : )


这篇关于如何查找一个particulr文件夹中有多少个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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