sob_l Posted June 5, 2018 Posted June 5, 2018 Hi all, I have been working on some automatic logging of some wireless devices using TeraTerm. I'm basically pinging a few satellites in a mesh network system and detecting when the ping drops, using a batch script. Whenever it drops, I open a TeraTerm window, connect it to Telnet, send some commands, and save the outputs of those commands to a log text file. However, my script is currently overwriting the previous log file every time ping fails (i.e. every time I trigger the TeraTerm macro). I want to know if there is a way, possibly using TeraTerm syntax, for me to check if a log file with a certain name "log.txt" already exists, then generate a new log file, say "log-1.txt", "log-2.txt", etc. if it does, so that I don't overwrite the results of each trial. Any help would be much appreciated. Thanks.
guner7 Posted March 18, 2019 Posted March 18, 2019 (edited) You might had asking in the wrong forum though.. Btw, try this: filepath = YourFilePathHere strconcat filepath '\log_1.txt' ;new log will be start as Log_1.txt ;search if logs exists. If yes, new log will be added numbering suffix filesearch filepath if result=1 then i=1 do filepath=logpath i=i+1 int2str suffix i strconcat filepath '\log_' strconcat filepath suffix strconcat filepath '.txt' filesearch filepath loop while result=1 endif Edited March 18, 2019 by guner7
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now