IFNFILE Branch to label if file does not exist
<< Click to Display Table of Contents >> Navigation: Robo-FTP User's Guide > Script Programming > Script Commands > All Script Commands > IFNFILE Branch to label if file does not exist |
Syntax: |
IFNFILE |
[ file name ] GOTO [ label ] |
Arguments: |
[ file name ] |
Variable or string defining a file or path name; if no path is defined, Robo-FTP’s working folder is used. |
|
[ label ] |
A valid label within the current script file which is branched to if the specified file does not exist. |
Options: |
none |
|
This script command checks for the existence of the specified local file and branches to [ label ] if the file does not exist. Robo-FTP attempts to open the local file to ascertain if it exists or not, so make sure that you have the proper privileges to access the file. Wildcard characters are not permitted in the [ file name ] argument.
For example:
IFNFILE "c:\Program Files\Robo-FTP X.X\thisfile" GOTO not found
DASHBOARDMSG "File was found, uploading now ..."
SENDFILE "c:\Program Files\Robo-FTP X.X\thisfile"
GOTO done
:not found
DASHBOARDMSG "File not found."
:done
FTPLOGOFF
The IFNFILE command is only for use with local files. A combination of the FTPCD, GETSITEFILE and IFERROR commands is required to branch script execution based on the non-existence of a specific remote file, for example:
FTPCD "/root/subfolder"
GETSITEFILE "thisfile"
IFERROR= $ERROR_NO_FILE_FOUND GOTO not_found
DASHBOARDMSG "File was found, downloading now ..."
RCVFILE "thisfile"
GOTO done
:not_found
DASHBOARDMSG "File not found."
:done
FTPLOGOFF
STOP
Related command(s): IFFILE, DELETE, WRITEFILE, READFILE, WORKINGDIR, BROWSE