Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: No such File or Directory

$
0
0
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
    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);
        }
    }

Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>