我正在使用Intranet服务器的Excel加载项。文件夹名称包含名称c#目录
我有雇员的名字,每个人都有一个文件夹在内联网和这个文件夹可能有一个电源点文件可能没有。所以我需要读取每个名称的文件。
问题是名称: 每个文件夹名称具有以下模式:
surname, firstname
,但问题是谁包含多个名字作为名字或姓氏的名字:
ex: samy jack sammour. the first name is: "samy jack" and the last name is "sammour"
所以该文件夹将是:sammour,samy jack
但我只有字段名称,我不知道什么是姓氏或名字(它可能是“j ack sammour,samy“或”sammour,samy jack“)。所以我想这个代码来解决这个问题:
string[] dirs = System.IO.Directory.GetFiles(@"/samy*jack*sammour/","*file*.pptx");
if (dirs.Length > 0)
{
MessageBox.Show("true");
}
,但它给了我一个错误:
file is not illegal
我怎么能解决这个问题,并搜索所有possibilties
最好的方法是让所有带有\ *。\ *的文件放入列表。然后使用Linq在List <>上进行过滤/搜索。 –
jdweng
也许'[a-z \ s,] +'?.. –