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

Top  Previous  Next

 

Under some circumstances you may need to have FileLink send one or more files where you do not know the file name in advance. There may also be times when a local directory structure is unknown and you wish to obtain names of subfolders.

 

FileLink 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 FileLink monitors a specific directory named c:\File Uploads for the presence any file with an extension of .upload. When a file is found, FileLink dials the remote system and sends it.

 

WORKINGDIR "c:\File Uploads"

:loop

GETNEXTFILE "*.upload" /timeout=0

DIAL "555-1212"

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. 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.