get files from multiple directories by directory list

  • Thread starter Thread starter Rhadamants
  • Start date Start date
R

Rhadamants

Guest
using System.Collections.Generic;
using System.IO;

List<FileInfo> files = new List<FileInfo>();
DirectoryInfo rootDir = new DirectoryInfo(@"C:\Program Files (x86)\basic\data\");
var directories = rootDir.GetDirectories("20190314*");
foreach (var directory in directories)
{
files.AddRange(directory.GetFiles());
}

IEnumerable<string> fileNames = files.Select(f => f.FullName);

I need to search and file in multiple directories using a list.

Like regex 201903[10-20] orper month 2019[03,08,10].

Continue reading...
 
Back
Top