FTP Command Action

Executes a sequence of commands on an FTP, SFTP, or FTPS host.

Properties

Host

The FTP, SFTP, or FTPS host on which the specified commands will be executed.

Commands

The sequence of FTP commands to be executed. Command are executed in the order they are entered on this property.

Because Flux must parse the commands internally before issuing them to the FTP server, the FTP Command Action does not support all of the FTP commands that may be available on your server. The FTP Command Action supports only the following commands, which are widely accepted across most FTP servers:

  • cd remote-directory
  • delete remote-file
  • get remote-file [local-target-file]
  • lcd local-directory
  • ls
  • mdelete regular-expression-to-match-remote-files
  • mget regular-expression-to-match-remote-files
  • mkdir remote-directory
  • mput regular-expression-to-match-remote-files
  • put local-file [remote-target-file]
  • pwd
  • quote command
  • rename remote-old-filename remote-new-filename
  • rmdir remote-directory

If you need to use a command that is not part of the list above, this action supports the "quote" command, which allows to pass a literal command to the FTP server. For example, if you wanted to issue the "HELP" command, you could set the following command on the FTP Command Action:

QUOTE HELP

Note that your FTP server must support the "quote" command to use this technique.

Result Properties

result

A sequence of responses from the remote server for each FTP command that the server executed. The response from each FTP command, including empty responses, are listed in the same order as the FTP commands.

You can iterate over the sequence of responses by using ?Runtime Data Mapping to pass this result property to a ?For Each Collection Element Action.

The Java type of this result property is java.util.List.

FTP Command Action and File List Parsers

Unlike other actions that support FTP hosts, the FTP Command Action does not support file list parsers. Because the FTP Command Action does not whether the result from the FTP server is a list of files or some other message (an error message from the server, for example) it is not able to effectively apply the file list parser.

If you need to parse the output of this action to retrieve a file name (or other data), you can use the Regular Expression Action to apply a regular expression directly to the response from the FTP server and extract the data you need. The most effective technique for this is to map the result to a ?For Each Collection Element Action (as described above), then apply the regular expression against the flow context variable created by that action.

FTP Command Action and Variable Substitution

The host and command properties of this action support ?Variable Substitution . For example, if you had a ZIP file named after today's date (i.e. 1-Jun-2011.zip), and you wanted to use the "PUT" command to send the file to your FTP server, you could add the follow to the commands for this action:

put ${date d-MMM-yyyy}.zip

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.