Beyond FTP Feature Tour
Beyond FTP Script
Editor - While/End_While Command
Back
to Feature Tour


The While command implements loops in Beyond FTP scripts.
There are three forms of this command. The first simply evaluates a
conditional expression and stops when this expression is false.
The second form performs a file expansion and loops for each name in the
expansion. The file name (without the path) is placed in the named variable
on each pass. This variable is a string type, and is valid ONLY within the
while loop. This allows the results of a single expansion to be used in
multiple commands. The advantage of this approach is that only those files
included in the expansion will be processed. New files arriving after the
expansion will be processed the next time the script is run. The
disadvantage is that each file is processed individually. There is no
parallel processing for multiple files, which can increase the total run
time for the script.
The third form reads sequentially through a text file and loops for each
line in the file. Lines are terminated by carriage returns and line feeds.
The entire contents of a line are placed in the named variable on each pass.
There is a single special case. Lines that begin :Server: are assumed to be
from a server list, and only the portion of the line following the :Server:
command are returned. This allows you to easily parse a server list.
While commands may be nested. The Break command may be used to exit a while
loop at any time. Break exits only the loop within which it occurs.
Example:
:While: ( %’Counter’ < 5 )
:Assign: Counter = %’Counter’ + 1
:Log: Iteration %’Counter’
:End_While:
:While: LoopFile = Next {APTServe}c:\outbound\*.txt
:From: {APTServe}c:\outbound\%’LoopFile’
:To: c:\inbound\%’LoopFile’
:if: CompletedOK Transfer In
:Delete_Files: {APTServe}c:\outbound\%’LoopFile’
:Else:
:Log: Transfer failed %’LoopFile’
:Break:
:End_If:
:End_While:
Back
to Feature Tour

|