Hello,
First I'd like to say that you have a great product here!
I am working with the latest binary (SshNet 4.0 Binary, 2013.4.7) and still get the scp error: "No such File or Directory" when trying to upload a file using the scp client. My C# code is listed below, but I have tried many variations of of this code based on the forum discussion with the same results. The target directory on linux "/data" is valid. Any suggestions would be greatly appreciated.
Thanks
Jim
First I'd like to say that you have a great product here!
I am working with the latest binary (SshNet 4.0 Binary, 2013.4.7) and still get the scp error: "No such File or Directory" when trying to upload a file using the scp client. My C# code is listed below, but I have tried many variations of of this code based on the forum discussion with the same results. The target directory on linux "/data" is valid. Any suggestions would be greatly appreciated.
Thanks
Jim
private void SCP_Upload_File()
{
try
{
string file = "C://temp//test.sh";
if (!File.Exists(file)) return;
FileInfo scriptInfo = new FileInfo(file);
if ( ! scriptInfo.Exists) return;
ConnectionInfo connectionInfo = new PasswordConnectionInfo(host, port, user, pw);
ScpClient scpClient = new ScpClient(connectionInfo);
scpClient.BufferSize = 8 * 1024;
scpClient.Connect();
if (!scpClient.IsConnected)
{
return;
}
string targetPath = @"/data/test.sh";
scpClient.Upload(scriptInfo.OpenRead(), targetPath);
scpClient.Disconnect();
}
catch (Exception e)
{
lb_Log.Items.Add(e.Message);
}
}