Thursday 31 October 2013

FTP task in SSIS

In this article i will explain about FTP task in SSIS. FTP(File transfer protocol) task enables us to move or delete local and remote files and create or delete local and remote directories.

Following file transfer operations can be performed using FTP task

Send Files: send files from local server to FTP server

Receive Files: receive files from FTP server to local server

Create local Directory: creates directory on local server

Create remote Directory: creates directory on FTP server

Remove local Directory: removes directory on local server

Remove remote Directory: removes directory on FTP server

Delete local files: delete files on local server

Delete remote files: delete files on FTP server

Drag FTP task from tool box on to control flow design editor as shown in Figure 1

 image Figure 1

Double click on FTP task which takes us to configuration editor as shown in Figure 2.

image Figure 2:

In General tab, select <new connection…> under FTPConnection which opens FTP connection manager as shown in Figure 3 where you need to configure FTP connection.server name property contains FTP server address and set server port as 21 which is default for most FTP servers. You can change server port number if required and Credentials should be specified if FTP connection requires.

Time-out(in seconds) property indicates how much time package tries before task fails and select use passive mode option to enable passive mode.Retries property shows how many times package should try to connect FTP server and last option Chunk size(in KB) specifies the data transfer size.

image  Figure 3

Click on Test connection button to verify whether FTP connection is established or not. Next options in General tab is StopOnFailure specifies whether task should fail or not if FTP connection is failed.

Once you have configured FTP connection, move to File Transfer tab where you need to specify Local path and Remote path either through File connection or an variable as shown in Figure 4.

image  Figure 4

Remote path allows us to browse remote server files or directories and select as shown in Figure 5

image Figure 5

For the purpose of example Create FTP connection with FTP server ftp.microsoft.com and choose file transfer operation as receive files and select Remote path as /bussys/readme.txt and localpath as Desktop. After configuration, Task editor will be shown as Figure 6. executing this package gets the file readme.txt from bussys folder onto desktop.

imageFigure 6

4 comments: