Topic "put command using winscp.com and c#"

Author Message
dmishoe

Guest


/// 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.FileName = "test_daimler.vdi";

winscp.StartInfo.CreateNoWindow = true;
winscp.Start();

/// Feed in the scripting commands
winscp.StandardInput.WriteLine("option batch on");
winscp.StandardInput.WriteLine("option confirm off");
winscp.StandardInput.WriteLine("open mysession");
winscp.StandardInput.WriteLine("ls");
winscp.StandardInput.WriteLine("RM *.vdi*");
winscp.StandardInput.WriteLine("ls");

winscp.StandardInput.WriteLine("put c:\\test_daimler_1.vdi ");
//winscp.StandardInput.WriteLine("get *.*");
winscp.StandardInput.WriteLine("ls");
winscp.StandardInput.Close();

/// Collect all output (not used in this example)
string output = winscp.StandardOutput.ReadToEnd();

Console.WriteLine("output:" + output);


when I run the above script, the file names get put on the server as
%SFLNDSFTPT%SFLNDSFTPT%null%DONE%test_daimler1.vdi_0bte0l005q8e34fp00004srm

I can't seem to control the file name.

Any and all help would be greatly appreciated.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
I do not understand what is the problem and what are you trying to achieve. Please try again.
_________________
Martin Prikryl
dmishoe

Guest


prikryl wrote:
I do not understand what is the problem and what are you trying to achieve. Please try again.


I do not want winscp to alter the file name.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
How does the original file name look like?
_________________
Martin Prikryl
dmishoe

Guest


the original file name is:
winscp.StandardInput.WriteLine("put c:\\test_daimler_1.vdi ");
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
It is unlikely that is caused by WinSCP. It's likely being done on the server side.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License