How to look for different types of files in a directory?
- by herrow
public List<string> MapMyFiles()
{
List<FileInfo> batchaddresses = new List<FileInfo>();
foreach (object o in lstViewAddresses.Items)
{
try
{
string[] files = Directory.GetFiles(o.ToString(), "*-E.esy");
files.ToList().ForEach(f => batchaddresses.Add(new FileInfo(f)));
}
catch
{
if(MessageBox.Show(o.ToString() + " does not exist. Process anyway?",
"Continue?", MessageBoxButtons.YesNo)
== DialogResult.Yes) { }
else
{
Application.Exit();
}
}
}
return batchaddresses.OrderBy(f => f.CreationTime)
.Select(f => f.FullName).ToList();
}
i would like to add to the array not only
.ESY
but also
"p-.csv"
how do i do this?