FTP_DIRLIST

LANSA Composer

FTP_DIRLIST

This Activity retrieves a list of files from a remote host using FTP. It connects to the remote FTP host and retrieves the names of files from a directory on the remote host. Details of the remote host and directories is taken from an FTP Configuration. A list of the files retrieved is output. The list is output in two formats - one containing just the file names, the other containing the full local path and file name.

Activities that populate list variables are often followed by a LOOP processing sequence directive or other constructs to process the contents of the list.  Refer to Variables and Lists for more information about the use of list variables.

An email Event notification named FTPDIRLISTFAIL is available in this Activity. If this event is active and a failure occurs in this Activity, then an email will be sent. Refer to Event Maintenance for setting up Event notifications.

INPUT Parameters:

FTPCONFIG : Required

This parameter should contain the name of an FTP Configuration. This Configuration can be created and maintained using the FTP Configuration option in the Navigator.

If this parameter is not provided or is not found, this Activity will return an error and processing will be abandoned.

REMOTEDIRECTORY : Optional

If it contains a non-blank value it will be used as the directory on the remote host from which the list of files are retrieved. If this parameter is not provided, then the remote host directory from the FTP Configuration will be used. Note that this is a required parameter if configuration of type command list is used.

GETLIKE – Optional

If it contains a non-blank value it will be used as the pattern use to identify files to be listed. Note that if this is specified, only files matching the given pattern will be listed. If blank, values from the FTP Configuration will be used.

OUTPUT Parameters:

FILELIST

Specifies the name of a list variable that will contain a list of files from the remote host. The list will contain only the file name.
For example:   order5.csv

FILEPATH

Specifies the name of a list variable that will contain a list of files from the remote host. The list will contain the full path and file name.
For example:   /inftp/order5.csv

This list may be used as an alternative to the FILELIST

Processing

This Activity uses either the LANSA Integrator FTPService or SFTPService (depending on FTP configuration choices).

It uses the Connection information from the FTP Configuration to connect to the remote host.

It changes directory on the remote host to the directory specified either in the input parameter or the FTP Configuration. It lists the files in that directory. If the parameter GETLIKE is specified or if the FTP Configuration is an Inbound configuration and contains a Get files like pattern, then only files which match that pattern are listed. FTP mode is changed to Binary if required.

The output lists will contain each file in the directory.

Any failure encountered when executing, will attempt to invoke the email Notification event, FTPDIRLISTFAIL. If this event is active then an email will be sent to the specified email address with a notification of the failure.