Using the %lastfile and %lastpath Variables

Top  Previous  Next

 

When a file transfer is attempted using either the SENDFILE or RCVFILE command, the file's name is stored in the %lastfile internal variable and the full name including drive and folder path is stored in the %lastpath internal variable.

 

These variables are useful for error reporting, for example:

 

SENDFILE "*.txt"

IFERROR= $ERROR_SUCCESS GOTO done

SET body = "An error occurred [" + %lasterror "] while attempting to upload " + %lastpath + %crlf

SET from = "Robo-FTP Upload Script"

SET email = "[email protected]"

SET subj = "Whoops!"

CREATEMAIL from email subj body ""

SENDMAIL "smtp.mydomain.com" "FTP Administrator" "[email protected]"

:done

 

 

See also: Internal Script Variables