Using the %sitefile and %sitedir Variables

Top  Previous  Next

 

The GETSITEFILE and FTPGETFILE commands search the current directory on a remote site for files with names matching the [ file name ] argument and, if a match is found, they populate the %sitefile internal script variable with the file name. If no matching file is found the value of %sitefile is set to an empty string.

 

The GETSITEFILE command can also optionally be instructed to return the names of subdirectories along with the names of any other matching files by adding the /incldirs option. In this case, when the name of a subdirectory matches the [ file name ] argument, the directory name is returned in the %sitedir variable and the value of the %sitefile variable is set to an empty string.  The /incldirs option behaves differently when used with the FTPGETFILE command.

 

Consider the following example in which Robo-FTP monitors the current remote site directory for the presence of any file with an extension of .rdy. When a matching file is found, Robo-FTP downloads it, deletes it from the site, and then loops back to search for another file. This type of continuous download loop is sometimes referred to as a hot receive process.

 

:loop

GETSITEFILE "*.rdy" /timeout=0

RCVFILE %sitefile /delete

GOTO loop

 

 

Note: To increase compatibility with command scripts written in previous versions of Robo-FTP, the %sitefolder and %serverdir internal variables both contain the same value as %sitedir and also the %serverfile internal variable contains the same value as %sitefile.  The platform of the remote server controls which path-separator character appears in the %sitedir, %sitefolder and %serverdir internal variables.

 

 

Related Command(s): GETSITEFILE, FTPGETFILE

See Also: The "Hot Receive" Feature, Using %sitefiledate, %sitefiledatetime and %sitefiletime, Internal Script Variables