The SSIS FTP Task is used to perform different kinds of operations on Files and Folders (or Directories). In this article we will show you the steps involved in configuring the SSIS FTP task send multiple files with example. In order to send single file, Please refer SSIS FTP Task Send Files article.
Following screenshot will show you the data inside the local folder. Our task is to Copy all the existing files from the File System Folder to FTP Server’s Root directory.
Below screenshot shows you the data inside the FTP Server.
SSIS FTP Task Send Multiple Files
In order to send multiple files from local computer to FTP Server, First Drag and drop the Foreach Loop Container into the Control Flow region as shown below
Double click on it will open the Foreach Loop Editor to configure it. Before we step into the remaining properties, we have to understand the Enumerator property. 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.
Next, Click on the Browse button to select the folder name from our file system. From the below screenshot you can observe that, we are selecting FILE SYSTEM TASK – COPY FILES folder in our E Drive. Click OK button to select it.
Within the Files section we have to specify the file type using the Wildcards. In this example, we want to send all files (irrespective of extensions) from our local file system to FTP server so we are using Wildcard *.*.
TIP: If you want to send only text files then use: *.txt
Next, we have to store the file names in a variable so that we can use them in our FTP Task. In order to do that, go to Variable Mappings section and select the user variable (if any) or create new variable as shown below
Once you click on the <New Variable..>, Add Variable window will be opened to create new variable. In this example, we require variable to store the File name and its extension for example, cache.xml so we are creating string variable and assigned the name as Var_FileNames. Click OK to finish creating string variable.
Now select the created variable and assign it to index 0 as we shown in below screenshot. Once you are done, Click OK to finish configuring the Foreach Loop Container.
Next Drag and drop the FTP Task into the Foreach Loop Container and rename it as SSIS FTP Task Send Multiple Files
Double click on it will open the FTP Task Editor to configure it. Please change the task name according to your requirements and provide the valid description.
Within the Connection section, We have a property called FTPConnection. By clicking on the drop down arrow will show you the already created FTP Connections (If any) or please click on the <New Connection..> option to create one. In this example, We are using the already created Connection (FTP Connection Manager) as shown below. Please refer SSIS FTP Connection Manager article to understand the connection settings
Please click on the File Transfer tab to configure the FTP operations. Following screenshot will show you the available properties in this tab.
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
In our previous step we used the Foreach Loop Container to loop over the files and stored the File names with extension in a variable called Var_FileNames. So, we are setting the IsLocalPathVariable to True and selecting the User:Var_FileNames variable as LocalVariable as shown in below screenshot.
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 besides this option to open the remote directory.
Currently we don’t have any sub folders in our FTP Server so, we are selecting the root directory / as the location. Next we are setting the OverwriteDetination property to true. It means SSIS FTP Task will overwrite any existing files (cache.xml and Remove Double Quotes in Excel Sheet using SSIS 1.jpg) in the FTP Server.
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.
Well, We successfully Copied the files present inside the File System Folder to FTP Server’s Root directory.
Thank You for Visiting Our Blog.