Writes received data to a file. (version 5.6.0 or later)
recvfile <filename> <binary flag> <auto-stop wait time>
Writes the data received from the host to the file specified by <filename>.
The next command will not be executed until the write is complete.
When <filename> is relative path, file is saved relative to file transfer folder.
Regardless of the numeric value of <binary flag>, the received data is written to the file unchanged.
No conversions are performed (kanji/codepage conversion, line-ending conversion, suppression of control-character output, etc.). Binary mode is fixed.
If no data is received for the number of seconds specified by <auto-stop wait time>, reception is terminated.
In that case the system variable result is set to 1; otherwise result is set to 0.
The unit of <auto-stop wait time> is seconds.
If a value less than or equal to 0 is specified, reception is not terminated and will wait indefinitely for data.
; Connect to the remote host
connect '192.168.0.10:22 /ssh /user=root /passwd=XXXXXX /auth=password'
; Wait for the shell prompt
waitregex '.*[$#] '
; Wait 3 seconds to allow recvfile to start
; Save stty settings to "save_stty"
; Run "stty raw" so that the remote host sends the output data exactly as-is, without any modification
; Print /var/log/messages to stdout
; Restore stty settings
; Wait 5 seconds to signal the end of transmission
sendln 'sleep 3; save_stty=$(stty -g); stty raw; cat /var/log/messages; stty "${save_stty}"; sleep 5'
; Wait 1 second for sendln to complete
pause 1
; Save received data to C:\tmp\messages
; Exit recvfile if no data is received for 3 seconds
recvfile 'C:\tmp\messages' 1 3
; Wait for the shell prompt
waitregex '.*[$#] '
; Log out from the remote host
sendln 'exit'
; Close Tera Term
closett
; End macro execution
end