-
Notifications
You must be signed in to change notification settings - Fork 8
getFileList
MicroBlaster edited this page Nov 10, 2019
·
2 revisions
Purpose: Populates a specified array with any files that match a specified Mask (like *.ts).
Syntax: getFileList {array} {Mask}
Notes: This command allows a script to inventory the TWX folder or a subfolder for filenames that match the Mask's search criteria, using ? and * wildcards as needed. A variable matching the array name will be created with the number of files found.
Example:
# Search the logs to find any Starports that have been initiated.
getFileList $logs "logs\*" & GAMENAME & ".log"
# if 20 files where found, the variable '$logs' now equals 20.
# $logs[1] is the 1st file name, $logs[2] the 2nd, and so on.
echo "*A total of " $logs " Logs found."
setVar $a 1
while ($a <= $logs)
echo "**Now Searching file " $logs[$a] "..."
readToArray "logs\" & $logs[$a] $linesArray
setVar $b 1
while ($b <= $linesArray)
getWordPos $linesArray[$b] $pos "began construction!"
if ($pos > 0)
echo "*" $linesArray[$b]
add $newPortCount 1
end
add $b 1
end
add $a 1
end
echo "**Complete, " $newPortCount " ports have been logged.*"
.