FTP - FXP

Declaration

<AMFTP ACTIVITY="fxp" SOURCE="text" DEST="text" SUBFOLDERS="YES/NO" KEEPFOLDERSTRUCT="YES/NO" OVERWRITE="YES/NO" ONLYIFEXIST="YES/NO" MATCHCASE="YES/NO" CHECKSUM="YES/NO" EXCLUDE="text" RE="YES/NO" RESULTDATASET="text" SESSION="text" DESTINATIONSESSION="text" />

Related Topics  

Description

File eXchange Protocol (FXP) allows data to be transferred from one FTP server to another (also known as inter-server transfers) without routing the data through the client's connection. FXP eliminates transferring data from one FTP server to a local client then to the second FTP server. In addition, the data transfer rate is independent of the client's Internet connection speed as it is based on the connection speed between the two servers, which is usually higher in bandwidth than a normal client connection.

NOTE: This activity is supported only in standard or SSL/TLS FTP connection types. To use this activity, you must first log onto both the source and destination FTP server using the FTP Log On activity and create a separate session name for each.

Practical Usage

Used for copying data from one FTP server to another. The advantage of using FXP over FTP is evident when a high-bandwidth server demands resources from another high-bandwidth server, but only a low-bandwidth client, such as a network administrator working away from location, has the authority to access the resources on both servers.

Parameters

Connection

Property

Type

Required

Default

Markup

Description

Source server session

Text

Yes

FTPSession1

SESSION="Server1"

The session name used to log onto the source FTP server.

NOTE: You must first log onto both the source and destination FTP server using the FTP Log On activity and create a separate session name for each.

Destination server session

Text

Yes

(Empty)

DESTINATIONSESSION="Server2"

The session name used to log onto the destination FTP server.  

NOTE: You must first log onto both the source and destination FTP server using the FTP Log On activity and create a separate session name for each.

File

Property

Type

Required

Default

Markup

Description

Source server file(s)

Text

Yes

(Empty)

  1. SOURCE="/sourcefoldername/file.txt"

  2. SOURCE="/sourcefoldername/*.txt"

  3. SOURCE="/source/*.txt|/source/*.doc"

  4. SOURCE="file.txt"

The file(s) from the source server to transfer. This can be a fully qualified UNIX style path and filename (preferred) or a single file (requires use of the FTP Change Folder action). Wildcards (i.e. *.* or ?) may be used to specify files matching a certain mask. Multiple file and/or file masks may be specified by separating the entries with a "|" symbol  (i.e. *.txt|*.bak).

Destination server file(s)

Text

Yes

(Empty)

  1. DEST="/destination_folder/file.txt"

  2. DEST="/destination_folder/*.txt"

  3. DEST="/folder/*.txt|/folder/*.doc"

  4. DEST="file.txt"

The location in the destination server in which to transfer the files. This can be a fully qualified path or a filename or a single file (requires use of the FTP Change Folder action).

Create and Populate FXP Dataset

Text

No

(Empty)

RESULTDATASET="theDataset"

The name of a dataset to be populated with information regarding the file(s) to be transferred. Refer to the Notes section below for more details about the dataset fields this activity creates.

File Options

Property

Type

Required

Default

Markup

Description

Include subfolders

Yes/No

No

No

SUBFOLDERS="YES"

If set to YES, specifies that, if present, subfolders should be searched for files matching the mask specified in the Source Server File(s) parameter. The default value is NO.

Preserve folder structure

Yes/No

No

No

KEEPFOLDERSTRUCT="YES"

If set to YES, specifies that subfolders found in the source folder should be created in the destination folder and source files should be copied into their respective folders rather than directly into the root of the target folder specified in the Destination Server File(s) parameter. The default value is NO.

This option is available only if the Include Subfolders parameter is set to YES.

Only folder structure

Yes/No

No

No

ONLYFOLDERSTRUCT="YES"

If set to YES, indicates that subfolders found in the source folder should be created in the destination folder but no files will be copied. Enabling this option causes any file-specific parameters to be ignored. The default value is NO.

This parameter is available only if the Include Subfolders parameter is set to YES.

Overwrite if exists

Yes/No

No

No

OVERWRITE="YES"

If set to YES, specifies that, if files already exist in the destination, they should be overwritten. The default value is NO.

Only if exists in destination

Yes/No

No

No

ONLYIFEXIST="YES"

If set to YES, indicates that only files that already exist in the destination will be copied from the source. All other files, regardless of whether they match the mask or other parameter settings will be bypassed. The default value is NO.

This parameter is valid only if the Overwrite if exists parameter is set to YES.

Match case

Yes/No

No

No

MATCHCASE="YES"

Indicates whether the properties set within this activity should be case sensitive in relation to the FTP servers. The default value is NO.

Transfer type

Options

Yes

Binary

TRANSFERTYPE="ascii"

Specifies whether the transfer type should be set to binary or ASCII mode. The default is Binary.

  • ASCII - The transferred data is considered to contain only ASCII formatted text. The party that is receiving the transferred data is responsible for translating the format of the received text to one that is compatible with their operating system.

  • Binary - Refers to transferring files as a binary stream of data. Where ASCII mode may use special control characters to format data, binary mode transmits the raw bytes of the file being transferred. In this way, the file is transferred in its exact original form.

Validate checksum

Yes/No

No

No

VALIDATECHECKSUM="YES"

Indicates whether to validate the integrity of data being transferred by calculating a checksum using the selected algorithm. The default value is NO.

Checksum type

Options

No

CRC

CHECKSUMTYPE="sha1"

Specifies the checksum algorithm to use. The available options are:

  • CRC (Default) - Stands for "cyclic redundancy check", so called because the check (data verification) value is a redundancy and the algorithm is based on cyclic codes.  

  • MD5 - A message-digest algorithm that's a widely used cryptographic hash function producing a 128-bit hash value, typically expressed in text format as a 32 digit hexadecimal number.

  • SHA1 - Stands for "secure hash algorithm" and produces a 160-bit hash value. A SHA-1 hash value is typically rendered as a hexadecimal number, 40 digits long.

These options are available only if the Validate Checksum parameter is set to YES.

Exclude mask

Text

No

(Empty)

EXCLUDE="*.txt"

Causes this activity to omit any files matching the mask(s) specified. Filenames or wildcard (i.e. * or ?) masks may be used, multiple entries may be specified by separating them with the | symbol (i.e. *.txt|*.bak).

Regular expression

Yes/No

No

No

RE="YES"

Indicates whether the value in the Exclude Mask parameter is a regular expressions. Regular Expression, also referred to as regex or regexp, provides a concise and flexible means for matching strings of text.

 

Description

Error Causes

On Error

Notes

Datasets

The table below describes the set of columns that a dataset creates exclusive to this activity (assuming the dataset name assigned was theDataset).

 

Name

Data Type

Return Value

theDataset.FXPResult

Boolean

The result of the transfer. If successful, 1 is returned. Otherwise, 0 is returned.

theDataset.FTPFileDate

Date

The modified date and time of the file to download.

theDataset.FTPFileName

Text

The name of the file to download.

theDataset.FTPFileSize

Number

The size of the file to download (in kb).

theDataset.LocalFileName

Text

The local file name of the file.

Example

NOTE: The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Description

This sample task demonstrates the activities used to download files from one FTP server to another. The first two steps logs onto two separate FTP hosts and creates a unique session name for each connection. The third step performs the file transfer from one server to another. The last two steps are used to log off each FTP server.

 In order for this task to work in your environment, please make the appropriate modifications in the properties of each activity.

<AMFTP ACTIVITY="logon" SESSION="Server1Session" SERVER="ftp.server1.com" USERNAME="theuser" PASSWORD="AM2WknKdIcXr7JaSdh0lRfctA==aME" />

<AMFTP ACTIVITY="logon" SESSION="Server2Session" SERVER="ftp.server2.com" USERNAME="theuser" PASSWORD="AM2WknKdIcXr7JaSdh0lRfctA==aME" />

<AMFTP ACTIVITY="fxp" SOURCE="/Server1/myFolder/*.*" DEST="/Server2/myFolder/*.*" SUBFOLDERS="YES" KEEPFOLDERSTRUCT="YES" OVERWRITE="YES" RESULTDATASET="theDataset" SESSION="Server1Session" DESTINATIONSESSION="Server2Session" />

<AMFTP ACTIVITY="logoff" SESSION="Server1Session" />

<AMFTP ACTIVITY="logoff" SESSION="Server2Session" />