I have a list of file names, and I want to search a directory and all its subdirectories. These directories contain about 200,000 files each. My code finds the the file but it takes about 20 minutes per file. Can someone suggest a better method?
Code Snippet
String[] file_names = File.ReadAllLines(@"C:\file.txt");
foreach(string file_name in file_names)
{
string[] files = Directory.GetFiles(@"I:\pax\", file_name + ".txt",
SearchOption.AllDirectories);
foreach(string file in files)
{
System.IO.File.Copy(file,
@"C:\" +
textBox1.Text + @"\N\O\" +
file_name +
".txt"
);
}
}