I have a list of files from a local folder in a SSIS Script task and I need to log it to a SQL table. Is there any way that I can do it directly from the script task or may be put the results in a object variable and then populate that to a SQL table. I am not taking the option of For Each Loop container since I feel I can log more details from a Script task.
Code:
List<String> FileList = new List<string>();
List<String> FileLoc = new List<string>();
foreach (string dirpath in Directory.EnumerateDirectories("C:\\Program Files\"))
foreach (string path in Directory.EnumerateFiles(dirpath))
{
FileList.Add(Path.GetFileName(path));
FileLoc.Add(Path.GetDirectoryName(path));
}
I would like to lof each FileList and FileLoc as individual columns in a table.
PS: I am new to C#.