So you have some code which does the job for one file.
You could:
- take the part which is reponsible for processing one file, and make it a method. Give this method the path to the file to be processed as a parameter.
- then enumerate the files to be processed, calling the method for each of them.
using System.IO;
void ProcessOneFile(string path)
{
}
DirectoryInfo folder = new DirectoryInfo();
foreach (FileInfo file in di.EnumerateFiles("*.json"))
{
ProcessOneFile(Path.Combine(folder.FullName, file.Name));
}
[Edit] Related links which may be useful:
DirectoryInfo Class (System.IO) | Microsoft Docs[
^]
FileInfo Class (System.IO) | Microsoft Docs[
^]
File Class (System.IO) | Microsoft Docs[
^]