Using the %lastfile and %lastpath Variables

Top  Previous  Next

 

Several of the file transfer protocols supported by FileLink, i.e., Zmodem, permit the remote system to supply the name of a file when it is received by FileLink. FileLink does provide a mechanism to override this remotely defined name, but when this is not used, you may use the %lastfile or %lastpath variables if you need to perform some operation on the file within a script file.

 

These internal script variables are replaced the file name or by the path and file name of the last file received by FileLink. If no file has been received, %lastfile and %lastpath are empty strings.

 

For example, consider the following script example where FileLink is waiting for the remote system to send a file named June Inventory.rpt.

 

PROTOCOL "zmodem"

:again

RCVFILE /timeout=0

IFSTRCMP %lastfile "June Inventory.rpt" goto got_it

MESSAGEBOX "Did not receive correct file"

GOTO again

:got_it

MESSAGEBOX "Inventory report received"