• You could create a separate script task that would count the files in the various subdirectories using an array list containing the subdirectories you want to search along with the System.IO.DirectoryInfo method and write the result to a global variable.

    Here is the code that you could use in the script task.

    Imports System.Collections

    Dim subdirs As New ArrayList

    subdirs.Add("C:\dir1\")

    subdirs.Add("C:\dir2\")

    subdirs.Add("C:\dir3\")

    subdirs.Add("C:\dir4\")

    subdirs.Add("C:\dir5\")

    Dim value As String

    For Each value In subdirs

    Dim di As New System.IO.DirectoryInfo(value )

    Dim aryFi As IO.FileInfo() = di.GetFiles("MyFileNameRoot*")

    Dim Count As Integer

    For Each fi In aryFi

    Count += 1

    Next

    Next

    Dts.Variables("Count").Value = Count

    You would have to create a global variable named Count and add it to the Read/Write variables in the Script Task Editor.

    To learn a enough about script tasks and global variables to make it work you could refer to my previous article

    Copy-and-Paste SSIS Execution Monitoring with Failure-Alert Email[/url].