I know that this code works for finding the newest file
var directory = new DirectoryInfo(tbxDir.Text);
if (Directory.Exists(tbxDir.Text))
{
var NewestFile = (from f in directory.GetFiles() orderby f.LastWriteTime descending select f).First();
...
}
What I can't imagine is how to extend it to:
- Use a pattern: e.g. a*c.txt
- Exclude a list of files (e.g. lst = { "log.txt", "ccc.txt", ...}
Can that be done with a Linq expression? Thanks for helping Patrick
Aucun commentaire:
Enregistrer un commentaire