IFSIZE Conditional branch upon file size comparison
<< Click to Display Table of Contents >> Navigation: Robo-FTP User's Guide > Script Programming > Script Commands > All Script Commands > IFSIZE Conditional branch upon file size comparison |
Form 1
Syntax: |
IFSIZE |
[ cond ] GOTO [ label ] |
Arguments: |
[ cond ] |
Variable or string defining a size condition to test against the internal %comparesize variable. |
|
[ label ] |
A valid label within the current script file which is branched to if the specified file exists. |
Options: |
none |
|
Form 2
Syntax: |
IFSIZExx |
[ size ] GOTO [ label ] |
Forms: |
IFSIZE= |
[ size ] GOTO [ label ] |
|
IFSIZE< |
[ size ] GOTO [ label ] |
|
IFSIZE> |
[ size ] GOTO [ label ] |
|
IFSIZE<= |
[ size ] GOTO [ label ] |
|
IFSIZE>= |
[ size ] GOTO [ label ] |
|
IFSIZE!= |
[ size ] GOTO [ label ] |
Arguments: |
[ size ] |
Variable, string, or numeric constant defining a numeric value to compare against the size of the file obtained with the most recently executed GETNEXTFILE, GETFILE, GETSITEFILE, or FTPGETFILE script command. |
|
[ label ] |
A valid label within the current script file which is branched to if the date condition is satisfied. |
Options: |
none |
|
Form 1 of this command is used in conjunction with the FILECOMPARETO and FILECOMPAREFROM script commands to test the results of a size comparison of a local file and a file on the FTP site.
Form 2 of this command is used in conjunction with the most recently executed GETNEXTFILE, GETFILE, GETSITEFILE, or FTPGETFILE command to compare the size of the file with a specified numeric value.
Description for Form 1
Possible result codes stored in %comparesize for the FILECOMPARETO command are listed below:
$ERROR_SRVR_FILE_LARGER |
1226 |
File on server is larger |
$ERROR_SRVR_FILE_SMALLER |
1226 |
File on server is smaller |
$ERROR_NO_SRVR_FILE_EXISTS |
1228 |
File does not exist on server |
$ERROR_SRVR_FILE_EMPTY |
1229 |
File exists on server but its length is 0 |
$ERROR_FILES_SAME_SIZE |
1234 |
Local and FTP site files identical in size |
Possible result codes stored in %comparesize for the FILECOMPAREFROM command are listed below:
$ERROR_FILES_SAME_SIZE |
1234 |
Local and FTP site files identical in size |
$ERROR_LOCAL_FILE_LARGER |
1235 |
Local file is larger |
$ERROR_LOCAL_FILE_SMALLER |
1236 |
Local file is smaller |
$ERROR_NO_LOCAL_FILE_EXISTS |
1239 |
Local file does not exist |
$ERROR_LOCAL_FILE_EMPTY |
1240 |
Local file exists but length equals 0 |
For example, the following conditional branch is taken if no file on the FTP site is found with the same name as a specified local file:
FILECOMPARETO "thatfile"
IFSIZE $ERROR_NO_SRVR_FILE_EXISTS GOTO no_file
Description for Form 2
The following conditional branch is taken if a local file just obtained with the GETNEXTFILE command has a size larger than 1000 bytes.
GETNEXTFILE "*.txt"
IFSIZE> 1000 GOTO good_file
Syntactically, no space is permitted to the left of the ‘!’, '=', '<' or '>' symbols, and a space is required to the right of these symbols.
Related command(s): IFNUM, IFFILE, FILECOMPARETO, FILECOMPAREFROM, GETNEXTFILE, GETFILE, GETSITEFILE, FTPGETFILE
See also: Comparing Local and Remote Files, Comparing File Dates and Times