How to look for different types of files in a directory?
Posted
by
herrow
on Stack Overflow
See other posts from Stack Overflow
or by herrow
Published on 2010-12-21T20:41:43Z
Indexed on
2010/12/21
20:54 UTC
Read the original article
Hit count: 163
c#
|filesystems
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?
© Stack Overflow or respective owner