Script Automation with logging

Advertisement

Quinsy
Joined:
Posts:
2

Script Automation with logging

Hey.

I'm trying to set the script to log what files getting copied over.

This is my command:
"C:\Program Files (x86)\WinSCP\winscp.com" /log=>>logfile.log /script="xxxxxxx"
My question is how to i get the log file to add time and date for the copy between each sessions, right now they all end up underneath each other with no timestamp.
I want to know when the copy was done.
Do I add /t or something, and where to I add it?

Reply with quote

Advertisement

Quinsy
Joined:
Posts:
2

Re: Script Automation with logging

I will post an example:
Searching for host...
Connecting to host...
Authenticating...
Using username "xxxxx".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] xxxxxxxxxx
/Outgoing
C:\xxxxxxxxxxx
test2.txt                 |            0 B |    0,0 KiB/s | binary |   0%
C:\xxxxxxxx
test2.txt                 |            0 B |    0,0 KiB/s | binary |   0%
Session 'xxxxxxxx' closed.
No session.
Searching for host...
Connecting to host...
Authenticating...
Using username "xxxx".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] xxxxxxx
/Outgoing
C:\xxxxxxxxx
test2.txt                 |            0 B |    0,0 KiB/s | binary |   0%
C:\xxxxxxxxxxxxxxxx
test2.txt                 |            0 B |    0,0 KiB/s | binary |   0%
Session 'xxxxxxx' closed.
No session.
Here I used the Script twice, but there is no time and or date between the different connections.

If you understand now?

And yes I do want it to just update the same logfile.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: Script Automation with logging

This is not a log file. It's the console output.

Only now I've noticed that you use a wrong syntax of the command-line. The >> should not be there. Use:
"C:\Program Files (x86)\WinSCP\winscp.com" /log=logfile.log /script="xxxxxxx"

Reply with quote

Guest

Hi,

I call WinSCP from a batch file, and in the batch file I explicitly log a line with date/time.

The batch file is like this:
echo %date% %time% ##### foo.cmd: Starting a cool winscp job >> L:\logs\job.log
winscp.com /privatekey=foo.ppk /script=script.txt >> L:\logs\job.log

Reply with quote

Advertisement

You can post new topics in this forum