// Aufruf:
//
// string[] saFilterList = { "*.csv", "*.txt" };
// List<string-> lFileList = this.GetFilesByFilter(@"c:\temp\", saFilterList);
//
// foreach (string f in lFileList)
// {
// ...
// }
//
using System.IO;
/// <summary>
/// listet Dateien eines Verzeichnisses anhand eines übergebenen Filters
/// </summary>
/// <param name="sPath">Suchpfad</param>
/// <param name="saFilterList">Filterliste (*.csv, *.txt)</param>
/// <returns>Dateiliste</returns>
public List<string-> GetFilesByFilter(string sPath, string[] saFilterList)
{
List<string-> lFileList = new List<string->();
if (Directory.Exists(sPath))
{
foreach (string filter in saFilterList)
{
lFileList.AddRange(Directory.GetFiles(sPath, filter));
}
}
return lFileList;
}