计算文件夹中的文件 [英] Count files in a folder

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

问题描述

我想计算使用C sharp代码在一天内出现的文件夹中的文件数。我是C sharp的新手。



我的尝试:



我现在还没有尝试过任何东西。我刚刚阅读了阅读文件夹的基础知识。

I want to count number of files present in a folder that comes in a day using C sharp code . I am newbie to C sharp.

What I have tried:

I have not tried anything as of now. I was just going through fundamentals of reading a folder.

推荐答案

我将查看System.IO.Directory.GetFiles方法Directory.GetFiles Method(String)(System.IO) [ ^ ]



这样的东西



I would be looking at the System.IO.Directory.GetFiles method Directory.GetFiles Method (String) (System.IO)[^]

Something like this

string path = @"C:\Some Path";
int fileCount = Directory.GetFiles(path, "*", SearchOption.AllDirectories).Length;


这篇关于计算文件夹中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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