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

mudoch

Glad I found this post, saved me some time. In the docs I did not notice if docs indicated if a feature was marked as only available after a specific version.

By the way I ran across WinSCP searching for SFTP applications and what a nice surprise it supports all of my needs, mainly running as a external scripted module that I can interface to. Thanks :D
martin

Re: XML Log With .NET

No reliable way.
Jeff

Re: XML Log With .NET

Are there a way to get a list of files in remote directory in 4.1.9 version using .NET code?
martin

Re: XML Log With .NET

XML logging is supported since 4.2 beta only.
Jeff

XML log with .NET

Hello,

I would like to add xml log to my .NET code. But the log file is not xml format. I did copy the following code:
...
const string logname = "log.xml";
 
/// Run hidden WinSCP process
Process winscp = new Process();
winscp.StartInfo.FileName = "winscp.com";
winscp.StartInfo.Arguments = "/log=" + logname;
winscp.StartInfo.UseShellExecute = false;
winscp.StartInfo.RedirectStandardInput = true;
winscp.StartInfo.RedirectStandardOutput = true;
winscp.StartInfo.CreateNoWindow = true;
winscp.Start();
 
/// Feed in the scripting commands
winscp.StandardInput.WriteLine("option batch abort");
winscp.StandardInput.WriteLine("option confirm off");
winscp.StandardInput.WriteLine("open mysession");
winscp.StandardInput.WriteLine("ls");
winscp.StandardInput.Close();
 
/// Collect all output (not used in this example)
string output = winscp.StandardOutput.ReadToEnd();
 
/// Wait until WinSCP finishes
winscp.WaitForExit();
...

Generated log file format:
. 2009-07-28 09:07:03.357 --------------------------------------------------------------------------
. 2009-07-28 09:07:03.358 WinSCP Version 4.1.9 (Build 416) (OS 6.0.6001 Service Pack 1)
. 2009-07-28 09:07:03.358 Login time: terça-feira, 28 de julho de 2009 09:07:03
. 2009-07-28 09:07:03.358 --------------------------------------------------------------------------
. 2009-07-28 09:07:03.358 Session name: TesteIceKiss
. 2009-07-28 09:07:03.358 Host name: 192.168.0.1 (Port: 21)
. 2009-07-28 09:07:03.358 User name: jhayashi (Password: Yes, Key file: No)
. 2009-07-28 09:07:03.358 Tunnel: No
. 2009-07-28 09:07:03.358 Transfer Protocol: FTP
. 2009-07-28 09:07:03.358 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2009-07-28 09:07:03.358 Proxy: none
. 2009-07-28 09:07:03.358 FTP: Passive: No
. 2009-07-28 09:07:03.358 Local directory: default, Remote directory: ImportarCreditoGenerico/, Update: No, Cache: Yes
. 2009-07-28 09:07:03.358 Cache directory changes: Yes, Permanent: Yes
. 2009-07-28 09:07:03.358 DST mode: 1
. 2009-07-28 09:07:03.358 --------------------------------------------------------------------------
. 2009-07-28 09:07:03.409 Connecting to 192.168.0.1 ...
. 2009-07-28 09:07:03.410 Connected with 192.168.0.1. Waiting for welcome message...
< 2009-07-28 09:07:03.411 220 Microsoft FTP Service
> 2009-07-28 09:07:03.411 USER jhayashi
< 2009-07-28 09:07:03.412 331 Password required for jhayashi.
> 2009-07-28 09:07:03.412 PASS *********
< 2009-07-28 09:07:03.414 230 User jhayashi logged in.
> 2009-07-28 09:07:03.414 SYST
< 2009-07-28 09:07:03.415 215 Windows_NT
> 2009-07-28 09:07:03.415 FEAT
< 2009-07-28 09:07:03.610 211-FEAT
< 2009-07-28 09:07:03.610     SIZE
< 2009-07-28 09:07:03.610     MDTM
< 2009-07-28 09:07:03.610 211 END
. 2009-07-28 09:07:03.610 Connected
. 2009-07-28 09:07:03.610 --------------------------------------------------------------------------
. 2009-07-28 09:07:03.610 Using FTP protocol.
. 2009-07-28 09:07:03.610 Doing startup conversation with host.
> 2009-07-28 09:07:03.610 PWD
< 2009-07-28 09:07:03.611 257 "/" is current directory.
. 2009-07-28 09:07:03.611 Changing directory to "ImportarCreditoGenerico/".
> 2009-07-28 09:07:03.611 CWD ImportarCreditoGenerico/
< 2009-07-28 09:07:03.613 250 CWD command successful.
. 2009-07-28 09:07:03.613 Getting current directory name.
> 2009-07-28 09:07:03.613 PWD
< 2009-07-28 09:07:03.614 257 "/ImportarCreditoGenerico" is current directory.
. 2009-07-28 09:07:03.614 Startup conversation with host finished.
. 2009-07-28 09:07:03.614 Retrieving directory listing...
> 2009-07-28 09:07:03.614 TYPE A
< 2009-07-28 09:07:03.615 200 Type set to A.
> 2009-07-28 09:07:03.616 PORT 192,168,0,78,7,239
< 2009-07-28 09:07:03.617 200 PORT command successful.
> 2009-07-28 09:07:03.617 LIST -a
< 2009-07-28 09:07:03.619 150 Opening ASCII mode data connection for /bin/ls.
< 2009-07-28 09:07:03.822 226 Transfer complete.
. 2009-07-28 09:07:03.822 Directory listing successful
. 2009-07-28 09:07:03.823 Disconnected from server

I would like to get a list of files in remote directory.