SSIS FTP Task Send Multiple Files

Let me show you the steps involved in configuring the SSIS FTP task to send multiple files with an example. To send a single file, Please refer to the FTP Task Send Files article.

NOTE: The SSIS FTP Task uses the FTP Connection Manager to connect with the Remote (FTP Server) Files and Folders.

The following screenshot will show you the data inside the local folder. Our SSIS FTP task is to send multiple files (all the existing files) from the File System Folder to the FTP Server’s Root directory.

SSIS FTP TASK SEND MULTIPLE FILES 0

The below screenshot shows you the data inside the FTP Server.

SSIS FTP TASK SEND MULTIPLE FILES 1

SSIS FTP Task Send Multiple Files

To send multiple files from the local computer to the FTP Server, First Drag and drop the Foreach Loop Container into the Control Flow region

SSIS FTP TASK SEND MULTIPLE FILES 2

Double-click on it will open the Foreach Loop Editor to configure it. From the below screenshot, you can observe that we are selecting Foreach File Enumerator because we want to loop over the files present in our file system.

SSIS FTP TASK SEND MULTIPLE FILES 3

Next, click on the Browse button to select the folder name from our file system. From the below screenshot, see that we are choosing the FILE SYSTEM TASK – COPY FILES folder in our E Drive. Click the OK button to select it.

SSIS FTP TASK SEND MULTIPLE FILES 4

Within the Files section, we must specify the file type using Wildcards. In this example, we want to send all files (irrespective of extensions) from our local file system to the FTP server, so we use Wildcard *.*.

TIP: If you want to send only text files, then use: *.txt

SSIS FTP TASK SEND MULTIPLE FILES 5

Next, we have to store the file names in a variable to use them in our FTP Task. To do that, go to the Variable Mappings section and select the user variable (if any) or create a new variable

SSIS FTP TASK SEND MULTIPLE FILES 6

Once you click on the <New Variable..>, the Add Variable window will open to create a new variable. In this example, we require variables to store the File name and its extension, for instance, cache.xml. So, we are creating a string variable and assigning the name as Var_FileNames. Click OK to finish creating a string variable.

SSIS FTP TASK SEND MULTIPLE FILES 7

Now select the created variable and assign it to index 0. Once you complete, Click OK to finish configuring the Foreach Loop Container.

SSIS FTP TASK SEND MULTIPLE FILES 8

Next, Drag and drop the FTP Task into the Foreach Loop Container and rename it as SSIS FTP Task Send Multiple Files.

SSIS FTP TASK SEND MULTIPLE FILES 9

Double-click on it will open the FTP Task Editor to configure it. Please change the task name according to your requirements and provide a valid description.

Within the Connection section, We have a property called FTPConnection. Clicking on the drop-down arrow will show the already created FTP Connections (If any), or please click on the <New Connection..> option to create one. In this example, we use the already created Connection (FTP Connection Manager). Please refer to the FTP Connection Manager article to know the connection settings.

SSIS FTP TASK SEND MULTIPLE FILES 10

Please click on the File Transfer tab to configure the FTP operations. The following screenshot will show you the available properties in this tab.

SSIS FTP Task Send Multiple Files 10

The FTP task in SSIS supports eight different operations on Files and Folders. In this example, we want to send multiple files to FTP Server. So, We are selecting the Send Files option from the Operations property.

SSIS FTP Task Send Multiple Files 11

In our previous step, we used the Foreach Loop Container to loop over the files and stored the File names with an extension in a variable called Var_FileNames. So, we are setting the IsLocalPathVariable to True and selecting the User:Var_FileNames variable as LocalVariable.

SSIS FTP TASK SEND MULTIPLE FILES 11

For the time being, we are declaring the Remote path manually, but in real-time, we recommend using variables. Please click on the browse (…) button beside this option to open the remote directory.

SSIS FTP TASK SEND MULTIPLE FILES 12

Currently, we don’t have any subfolders in our FTP Server. So, we selected the root directory / as the location and set the OverwriteDetination property to true. The SSIS FTP Task will overwrite any existing files (cache.xml and Remove Double Quotes in Excel Sheet using 1.jpg) in the FTP Server.

SSIS FTP TASK SEND MULTIPLE FILES 13

Click OK to finish configuring the SSIS FTP task send multiple files package. Let’s run and see whether we successfully Copied the .xml, .txt, .JPG, and .xls files from the local File System to FTP Server or Not.

SSIS FTP TASK SEND MULTIPLE FILES 14

Well, We successfully sent the files present inside the File System Folder to FTP Server’s Root directory.

SSIS FTP TASK SEND MULTIPLE FILES 15