Im trying to read from a text file that lists a number of hosts. I want to be able to connect to one host at a time , do a check for files and then move on to the next telnet host in my text file..Can anyone help out??
You will need to set up a loop that reads each host name in
from the file, then call a procedure that checks for your
files and logs out of the host. The code should look
something like:
if fopen 0 hostNames.txt READ TEXT ;open file for read only
while not feof 0 ;loop while not end of file
fgets 0 hostName ;get host name from file
dial TELNET hostName ;establish telnet session
while $dialing ;loop while establishing telnet session
endwhile
if $carrier ;if session established
waitfor "login: " forever
call checkForFiles ;call processing block
else
errormsg "Connection Not Establised To %s." hostName
endif
endwhile
else
errormsg "File Not Found"
endif
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.