Bagikan melalui


FTP Task

The FTP task downloads and uploads data files and manages directories on servers. For example, a package can download data files from a remote server or an Internet location as part of an Integration Services package workflow. You can use the FTP task for the following purposes:

  • Copying directories and data files from one directory to another, before or after moving data, and applying transformations to the data.

  • Logging in to a source FTP location and copying files or packages to a destination directory.

  • Downloading files from an FTP location and applying transformations to column data before loading the data into a database.

At run time, the FTP task connects to a server by using an FTP connection manager. The FTP connection manager is configured separately from the FTP task, and then is referenced in the FTP task. The FTP connection manager includes the server settings, the credentials for accessing the FTP server, and options such as the time-out and the number of retries for connecting to the server. For more information, see FTP Connection Manager.

Important

The FTP connection manager supports only anonymous authentication and basic authentication. It does not support Windows Authentication.

When accessing a local file or a local directory, the FTP task uses a File connection manager or path information stored in a variable. In contrast, when accessing a remote file or a remote directory, the FTP task uses a directly specified path on the remote server, as specified in the FTP connection manager, or path information stored in a variable. For more information, see File Connection Manager and Integration Services Variables.

This means that the FTP task can receive multiple files and delete multiple remote files; but the task can send only one file and delete only one local file if it uses a connection manager, because a File connection manager can access only one file. To access multiple local files, the FTP task must use a variable to provide the path information. For example, a variable that contains "C:\Test\*.txt" provides a path that supports deleting or sending all the files that have a .txt extension in the Test directory.

To send multiple files and access multiple local files and directories, you can also execute the FTP task multiple times by including the task in a Foreach Loop. The Foreach Loop can enumerate across files in a directory using the For Each File enumerator. For more information, see Foreach Loop Container.

The FTP task supports the ? and * wildcard characters in paths. This lets the task access multiple files. However, you can use wildcard characters only in the part of the path that specifies the file name. For example, C:\MyDirectory\*.txt is a valid path, but C:\*\MyText.txt is not.

The FTP operations can be configured to stop the File System task when the operation fails, or to transfer files in ASCII mode. The operations that send and receive files copy can be configured to overwrite destination files and directories.

Predefined FTP Operations

The FTP task includes a predefined set of operations. The following table describes these operations.

Operation

Description

Send files

Sends a file from the local computer to the FTP server.

Receive files

Saves a file from the FTP server to the local computer.

Create local directory

Creates a folder on the local computer.

Create remote directory

Creates a folder on the FTP server.

Remove local directory

Deletes a folder on the local computer.

Remove remote directory

Deletes a folder on the FTP server.

Delete local files

Deletes a file on the local computer.

Delete remote files

Deletes a file on the FTP server.

Integration Services includes a task that performs operations on files and directories in the file system.

For more information about this task, click the following topic:

Custom Log Entries Available on the FTP Task

The following table lists the custom log entries for the FTP task. For more information, see Implementing Logging in Packages and Custom Messages for Logging.

Log entry

Description

FTPConnectingToServer

Indicates that the task initiated a connection to the FTP server.

FTPOperation

Reports the beginning of and the type of FTP operation that the task performs.

Configuring the FTP Task

You can set properties through SSIS Designer or programmatically.

For more information about the properties that you can set in SSIS Designer, click one of the following topics:

For more information about how to set these properties in SSIS Designer, click the following topic:

Configuring the FTP Task Programmatically

For more information about programmatically setting these properties, click one of the following topics:

Integration Services icon (small) Stay Up to Date with Integration Services

For the latest downloads, articles, samples, and videos from Microsoft, as well as selected solutions from the community, visit the Integration Services page on MSDN or TechNet:

For automatic notification of these updates, subscribe to the RSS feeds available on the page.