This question might have been asked before, however I am not able to pass three parameters in single loop which I need for my method. I have like thousands of files in that directory (xml,jpg,tiff) (mixed).
This is something what I'm trying to get.
protected void btn_Click(object sender, EventArgs e)
{
var path = @"d:\xmlfiles";
foreach (var file in Directory.GetFiles(path))
{
ProcessFile(file,param2,param3);
}
}
static void ProcessFile(string file_xml, string file_jpg, string file_tiff)
{
// do processing here...
//Adding data to sql
}
I tried Path.GetExtension, but it only gives extension. I have to pass file name and the logic is in the method Processfile().
I saw many questions asked before which only returns single file. Any other way for a workaround?
- Directory.GetFiles() method in C#
- Directory.getfiles(): specific names of files c#
- Multiple filters with Directory.GetFiles?
- Directory.GetFiles() pattern match in C#
Any helpe would be appreciated. Thanks.