Reputation: 3438
Hi have a WinSCP script to put a file on remote server using SFTP, which is working fine. But I would enable logging to a text file on a local directory.
I have the following script
option batch on
option confirm off
# connect minute session
open sftp://xyz.com:22/ -privatekey=E:\PK\*.ppk
# force binary mode transfer
option transfer ascii
# navigate to mediacom and put file
lcd "E:\export\"
cd /mediacom/testdir
put "CI_Tst.tab"
# disconnect daily session
close
# exit WinScP
exit
Many I know how I can log results of above script to a local file?
Upvotes: 1
Views: 9603
Reputation: 202282
To enable logging, use the /log=
command-line switch of WinSCP:
winscp.com /script=C:\path\to\script.txt /log=C:\path\to\script.log
You can use patterns like !Y-!M-!D-!T-!P
to make the filename unique.
See https://winscp.net/eng/docs/ui_pref_logging#session_log
Upvotes: 3