【发布时间】:2018-07-18 10:55:26
【问题描述】:
使用以下代码,我可以获得名称中包含 string 的所有文件:
DirectoryInfo dirInf = new DirectoryInfo(path);
FileInfo[] fInfArray = dirInf.GetFiles("*string*");
但是如何排除GetFiles处的字符串。
我不是说像.txt 这样的结尾我想在文件名中排除string。
例如我有以下文件:
wordwordfile.msg
wordwordfile.txt
wodfile.txt
并排除 wod 得到以下文件:
wordwordfile.msg
wordwordfile.txt
【问题讨论】:
标签: c# getfiles directoryinfo