Using the %sitefile and %sitedir Variables

<< Click to Display Table of Contents >>

Navigation:  Robo-FTP User's Guide > Script Programming > Internal Script Variables >

Using the %sitefile and %sitedir Variables

 

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

 

 

To increase compatibility with command scripts written in previous versions of Robo-FTP, alternate versions of these variables have be preserved as follows:

 

 %serverfile contain the same value as %sitefile

 %sitefolder contain the same value as %sitedir

 %serverdir contain the same value as %sitedir

 

Note: 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: Using %sitefiledate, %sitefiledatetime and %sitefiletime, The "Hot Receive" Feature, Sample Script that Displays Files and Folders on the Remote Site, Internal Script Variables