In C# for SSIS, how can I create a create a 'Files Remaining' counter?
I have a function that gets the current number of files in a directory and stores that value in a variable. I have code that cleans and processes file data in a foreach loop and I would like the file remaining counter to interval down each time it starts a new file.
The function code to get the number of files in the directory is below:
// LOGIC TO COUNT THE NUMBER OF ROWS IN A FILE
public static long CountLines(string filename)
long result = 0;
using (var input = File.OpenText(filename))
while (input.ReadLine() != null)
and I call or show the variable in the Dts Output by using
// COUNT THE NUMBER OF FILES IN THE DROPOFF DIRECTORY
long filecount = Directory.GetFiles(dropfolder).Length;
Dts.Events.FireInformation(3, "File Count", "Number of files to be processed " + filecount.ToString("#,##0") + " files.", "", 0, ref fireAgain);