Using the %sitefile and %sitedir Variables

Top  Previous  Next

 

In versions prior to v1.50, these variables were %serverfile and %serverdir. Both sets of variables are accepted.

 

Under some circumstances you may need to have Robo-FTP retrieve one or more files from an FTP site where you do not know the file name in advance or even when such a file may be ready. We call this the hot receive feature. There may also be times when the directory structure of the FTP site is unknown and you wish to obtain names of subdirectories.

 

Robo-FTP provides GETSITEFILE command expressly to support the hot receive feature. The %sitefile variable, and optionally the %sitedir variable, are used in conjunction with this command. This internal script variable is replaced by the name of the file obtained by the GETSITEFILE command. If no file has been found, the value of %sitefile is an empty string.

 

In addition, there are options to this command to get the newest or oldest file present.

 

Consider the following example in which Robo-FTP monitors the current FTP site directory for the presence of any file with an extension of .rdy. When a file is found, Robo-FTP retrieves it.

 

:loop

GETSITEFILE "*.rdy" /timeout=0

RCVFILE %sitefile

GOTO loop

 

Optionally, the GETSITEFILE command can be instructed to return server subdirectory file names along with any other files that may be present by adding the /incldirs option. In this case, when a directory is found its name is returned in the %sitedir variable and the %sitefile variable is set to an empty string.

Refer to GETSITEFILE for more details.