FTPCMD        Send a "raw" FTP command

Top  Previous  Next

Syntax:

FTPCMD

[ cmd ] [ args ]

Arguments:

[ cmd ]

Variable or string defining the FTP command to be sent to the server. Arguments to the FTP command, if any, may be within this variable or string, or passed via [ args ].

 

[ args ]

Variable or string defining the arguments for the FTP command.

Options:

none

 

 

 

This command is not valid when connecting to a secure SSH site or an HTTP/HTTPS site.

 

This script command permits an FTP command (e.g., PWD, LIST) to be sent to the FTP site for execution. Any FTP command with the exception of STOR and RETR may be sent using this command. When connecting to a normal site you are typically much better off using the Robo-FTP script commands but FTPCMD may help you create work arounds for non-standard servers.

 

Responses from the FTP site to a particular FTP may be a single line of text (e.g., PWD) or multiple lines of text (e.g., LIST, HELP). Robo-FTP saves single line responses in an internal variable named %ftplastresult as well as writing them to the log file (if open).

 

For multiple line responses, Robo-FTP creates a temporary file and the response is written to this file. The file name is saved in an internal variable named %ftpresultsfile. If you need to retain the information in the temporary file, you should immediately copy it to another file as shown below:

 

FTPCMD "LIST"

COPY %ftpresultsfile "save_this_file"

 

The last line of the response is also saved in %ftplastresult. In some cases, the %ftplastresult variable may be used in conjunction with the FTPSETERROR script command in order to decode a specific FTP site reply. The %ftpresultsfile variable may be used in conjunction with any Robo-FTP file oriented script command (e.g., READFILE, PRINT).

 

The STOR and RETR FTP commands may not be used with this script command - use SENDFILE and RCVFILE instead respectively.

 

Consider the following example where Robo-FTP requests the current working directory on the FTP site and branches if the request fails. A typical server response might be: 257 ‘/’ is current directory.

 

FTPCMD "PWD"

FTPSETERROR

IFERROR!= 257 GOTO no_cur_dir

 

Consider the following example where Robo-FTP attempts to delete a file on the FTP site and branches if the proper access privileges are not assigned. A typical server response might be: 553 b1.c: Permission denied. (Delete).

 

FTPCMD "DELE" "b1.c"

FTPSETERROR

IFERROR= 553 GOTO dele_failed

 

The previous command could also have been specified as shown below.

 

FTPCMD "DELE b1.c"

 

Use of the FTPSETERROR script command is not required. If you are not concerned with the specific FTP site error, you may use Robo-FTP’s normal error handing as shown below.

 

FTPCMD "DELE" "b1.c"

IFERROR GOTO dele_failed

 

 

Related Commands: FTPSETERROR, IFERROR, READFILE, PRINT

See also: Using the %ftplastresult variable