I have written a C# console application that currently takes a data file as input, processes the data and writes out 2 new data files. I would like for it to be able to process ALL the files in a given directory. How might I do this? Thanks!
You can get a list of files in a directory by using the function Directory.GetFiles();
Here is an example that reads all the data from each file and stores it in the variable 'data'.
string directory = @"C:\";
foreach (string file in Directory.GetFiles(directory))
string data = "";
using (StreamReader sr = new StreamReader(file))
data = sr.ReadToEnd();
// Do something with the data from each file found