SSIS: Using the DirList property of the FTP and SFTP receive tasks
To use the User variable you've assigned to the DirList property of the task in a Foreach Loop Container first set the Enumerator to a Foreach ADO Enumerator. Under Variable Mappings you can specify a variable that maps to any of the following indices.
0 - Filename 1 - FileSize 2 - FileTime 3 - IsDir 4 - Listing
For more information about these values please consult the help file section on the DirList property.
To use the User variable you've assigned to the DirList property of the task in a Script Task first specify the variable in the list of ReadOnly or ReadWrite variables of the task. Within the Script Task you can do something like this:
Dim myTable As DataTable
Dim row As DataRow
Dim i As Integer
myTable = CType(Dts.Variables("User::DirList").Value, DataTable)
File.Create("C:\temp\list.txt").Close()
For i = 0 To myTable.Rows.Count - 1
row = myTable.Rows(i)
File.AppendAllText("C:\temp\list.txt", CType(row("Filename"), String) & vbCrLf)
Next
Dts.TaskResult = Dts.Results.Success
We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@nsoftware.com.