从文件夹中提取特定类型的文件 [英] Extracting specific type of files from a folder
本文介绍了从文件夹中提取特定类型的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只想从一个文件夹中提取.c,.c ++ 、. asm,.h文件.如果我使用以下代码,它将提取所有类型的文件.
i want to extract only .c,.c++,.asm,.h files from a folder . if i use following code it is extracting all types of files.
foreach (String f in Directory.GetFiles(rootdir,"*.cpp"))
{
Main.Nodes.Add(f);
}
通过使用上面的代码,我只能提取cpp文件,但是我想提取.c,.c ++ 、. asm,.h文件并添加到treeview.
by using above code i am able extract only cpp files but i want to extract .c,.c++,.asm,.h files and add to treeview.
推荐答案
检查此链接
谢谢
-Amit
Hi,
Check this link
thanks
-Amit
方法GetFiles
在解释文件掩码时存在严重缺陷.
此处说明并解决了此问题: Directory.Get.Files搜索模式问题 [ ^ ].
—SA
The methodGetFiles
has a serious flaw with interpretation of a file mask.
This problem is explained and resolved here: Directory.Get.Files search pattern problem[^].
—SA
转到此链接
DirectoryInfo.GetFiles方法(字符串,SearchOption) [ http://www.codeguru.com/forum/showthread.php?threadid=344379 [ ^ ]
http://www.beansoftware.com/ASP.NET-FAQ/Multiple-Filters-Directory.GetFiles-Method.aspx [ ^ ]
Hi,
go this links
DirectoryInfo.GetFiles Method (String, SearchOption)[^]
http://www.codeguru.com/forum/showthread.php?threadid=344379[^]
http://www.beansoftware.com/ASP.NET-FAQ/Multiple-Filters-Directory.GetFiles-Method.aspx[^]
这篇关于从文件夹中提取特定类型的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文