Using the %nextfile, %nextfolder , and %nextpath Variables

Top  Previous  Next

 

Under some circumstances you may need to have Robo-FTP send one or more files where you do not know the file name in advance. We call this the hot send feature. There may also be times when a local folder structure is unknown and you wish to obtain names of subfolders.

 

Robo-FTP provides GETNEXTFILE command expressly to support the hot send feature. The %nextfile and %nextpath variables, and optionally the %nextfolder variable, are used in conjunction with this command. The first two internal script variables are replaced by the file name and the path and file name, respectively, of the file obtained by the GETNEXTFILE command. If no file has been found, %nextfile and %nextpath are empty strings.

 

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 a specific folder named c:\File Uploads for the presence of any file with an extension of .upload. When a file is found, Robo-FTP dials an FTP site and sends it.

 

WORKINGDIR "c:\File Uploads"

:loop

GETNEXTFILE "*.upload" /timeout=0

DIALNET "MyConnection"

FTPLOGON "ftp.acme-widget.com"

SENDFILE %nextfile

DISCONNECT

GOTO loop

 

Optionally, the GETNEXTFILE command can be instructed to return local subfolder names along with any other files that may be present by adding the /incldirs option. In this case, when a folder is found its name is returned in the %nextfolder variable and the %nextfile variable is set to an empty string. In this case, the %nextpath variable contains the complete path name of the folder.

Refer to GETNEXTFILE for more details.