Thursday, May 3, 2012

C# CODE TO COPY FILE FROM WINDOWS TO UBUNTU



using System;
using System.Collections.Generic;
using Tamir.SharpSsh;
//using Tamir.Streams;


namespace CopyFileToUbuntu
{
    class Program
    {
        static void Main(string[] args)
        {

            string host = "ipaddress";
            string username = "username";
            string password = "password";
            string sourcePath = @"F:\sample.json";
            //string sourcePath = @"F:\";
            string destPath = "/home/myfolder/Archive/";

            Sftp sftpClient = new Sftp(host, username, password);

            sftpClient.Connect();
            sftpClient.Put(sourcePath, destPath);
         
            //sftpClient.Get( destPath,sourcePath );
            sftpClient.Close();
        }
    }
}

No comments:

Post a Comment