Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

(elmo) wrote:

Is there any other option to get continuous xml log?

You can merge them. E.g. using XSLT, it should be rather easy.
Any idea how to redirect this long mylog.txt or output.txt to xml?

I do not understand what you mean by "redirect to XML".
(elmo)

Hi Martin

Below script works fine.
Is there any other option to get continuous xml log? Any idea how to redirect this long mylog.txt or output.txt to xml?

winscp.com  /script=script.txt /parameter user:password@host1 /log=mylog.txt > output.txt 

winscp.com  /script=script.txt /parameter user:password@host2 /log=mylog.txt >> output.txt
winscp.com  /script=script.txt /parameter user:password@host3 /log=mylog.txt >> output.txt
martin

To append an output to a file in the batch file, use >>:
winscp.com  /script=script.txt /parameter user:password@host1 /log=mylog.txt > output.txt

winscp.com  /script=script.txt /parameter user:password@host2 /log=mylog.txt >> output.txt
winscp.com  /script=script.txt /parameter user:password@host3 /log=mylog.txt >> output.txt

You can also make XML log file name unique by using a pattern like !S-!Y!M!D!T:
winscp.com  /script=script.txt /parameter user:password@host1 /log=mylog-!S-!Y!M!D!T.xml

See https://winscp.net/eng/docs/ui_pref_logging#session_log
(elmo)

Maybe there is option to make xml file additive?
I saw that for window version, there is option "Append" that caused adding log at the end of existing one.
Is there anybody who know how to force console to use that option.
(elmo)

Copying file to many destination and one log file.

Hi All

I have created run.bat file that is using script.
Main goal that i want to achieve is to send one file to many hosts and verify gather log that will be proof that transfer was succeed for all of them, or in case of failure I will be able to verify which one doesn't get file.

script.txt
open %1% -hostkey=*

cd /var/tmp
option transfer binary
put c:/winscp/example.txt
close
exit


run1.bat code
winscp.com  /script=script.txt /parameter user:password@host1 /log=mylog.txt

winscp.com  /script=script.txt /parameter user:password@host2 /log=mylog.txt
winscp.com  /script=script.txt /parameter user:password@host3 /log=mylog.txt


run2.bat code
winscp.com  /script=script.txt /parameter user:password@host1 /log=mylog.txt>output.txt

winscp.com  /script=script.txt /parameter user:password@host2 /log=mylog.txt>output.txt
winscp.com  /script=script.txt /parameter user:password@host3 /log=mylog.txt>output.txt


run3.bat code
winscp.com  /script=script.txt /parameter user:password@host1 /log=mylog.xml

winscp.com  /script=script.txt /parameter user:password@host2 /log=mylog.xml
winscp.com  /script=script.txt /parameter user:password@host3 /log=mylog.xml


When I start run1.bat i get proper mylog.txt but very long with redundant information, file is difficult to analyze
When I start run2.bat output.txt contain only host3 log
When I start run3.bat mylog.xml contain only host3 log

What should I do to get whole log like with run1.bat but in txt format or xml format.
Please give me some hint.

Thanks in advance.