从指定的路径获取相似文件名的计数 [英] Get Count of Similar FileNames from path specified

查看:68
本文介绍了从指定的路径获取相似文件名的计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在gridview我有一列"GETFILE"(绑定单个链接按钮).在gridview行绑定上,我必须动态检查带有微笑名称的文件名(例如:file,file_1,file_2),我不得不创建另外两个链接按钮.但是问题是,如何检查是否有3个文件名类似"file"的文件.我的意思是,使用IO操作如何获取具有类似文件名的3.
我sujjest发送一些代码,以便在指定的目录/路径中存在3个类似的文件.

我的意思是说我有4个文件,例如
file001
file001_AUS,
file001_US,
file001_IND
在动态创建4个链接按钮之前,我将如何知道有4个文件带有"file0001".
谢谢.

Hi every one,

In gridview i have a column with "GETFILE"(bound with single link button). On gridview rowbound i have to check file name with smilar name(eg: file,file_1,file_2) dynamically i had to create two other linkbuttons. but the problem is, how to check that there are 3 files with filename like "file". I mean how can i get count of 3 with similar filenames using IO operation.
I sujjest to send some code, so that there exists 3 such similar files in the directory/path specified.

What i mean to say is i have 4 files like
file001
file001_AUS,
file001_US,
file001_IND
before dynamically creating 4 link buttons,how will i know that there r 4 files with "file0001".
thanks.

推荐答案

gujjula swathi写道:
gujjula swathi wrote:

我的意思是我怎么能计数IO操作的3个具有相似文件名的文件.

I mean how can i get count of 3 with similar filenames using IO operation.



你到底是什么意思? 相似"是什么意思?如果它们不同(如果将它们存储在相同的位置,则必须一样),那么如果它们看起来有些相似,那又为什么重要呢?这里有什么问题?



What on earth do you mean ? What does ''similar'' mean ? If they are different, as they must be if you store them in the same places, then why does it matter if they look a bit alike ? What is the issue here ?


大家好,

我为此解决方案.使用Directoryinfo和fileinfo.下面的代码如下

//从特定目录获取文件名
DirectoryInfo dinfo = new DirectoryInfo(@"C:\ WINDOWS");
字符串x ="set";
FileInfo [] finfo = dinfo.GetFiles(x +"*.log");
foreach(finfo中的FileInfo fi)
{
Response.Write(fi.Name +< br/>");
}
Hi All,

i got the solution for this.Use Directoryinfo and fileinfo. the code below is as follows

//get set of filenames from a specific direcory
DirectoryInfo dinfo=new DirectoryInfo(@"C:\WINDOWS");
string x = "set";
FileInfo[] finfo = dinfo.GetFiles(x+"*.log");
foreach (FileInfo fi in finfo)
{
Response.Write(fi.Name+"<br/>");
}


这篇关于从指定的路径获取相似文件名的计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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