Using the %random variable
<< Click to Display Table of Contents >> Navigation: Robo-FTP User's Guide > Script Programming > Internal Script Variables > Using the %random variable |
The %random variable provides a simple mechanism for generating pseudo-random values. The %random variable evaluates to a pseudo-random integer between 1 and 65535.
You can also use subscripts to get padded pseudo-random values of a given length:
%random[2] - ranges from "01" to "99"
%random[2] - ranges from "001" to "999"
Consider the following example in which each downloaded files is renamed locally using %random:
FTPLOGON "mysite"
:morefiles
GETSITEFILE "*" /oldest
RCVFILE %sitefile
IFERROR GOTO end
SET newfilename = "file." + %date + "." + %time + "." + %random
MOVE %sitefile newfilename
GOTO morefiles
:end