How to get the files From SFTP

Last post 12-14-2009 4:02 PM by martinv. 1 replies.

Sort Posts:

  • How to get the files From SFTP

    12-10-2009, 8:38 AM

     

    HI all,

     

    I want to know the solution for getting the files from SFTP and get those files copy into my Local system.. How to do these all stuff now i am trying to get the files by using with 3rd party dll which are free source.(Tamir; Tamir.SharpSsh;) but i dnt get any solution. it is connecting to port but i dnt find any method to get the files in those dll classes. Hope u will give a solution..

     

    any suggestion..

    Regards
    Ravi
    Please click "mark as answer" if this post helped you.
  • Re: How to get the files From SFTP

    12-14-2009, 4:02 PM
    • Member
      10 point Member
    • martinv
    • Member since 06-04-2007, 2:55 PM
    • Posts 5

    Hi,

    you can try following code. It uses the Rebex SFTP component. The code is taken from the SFTP tutorial page.

    // create client, connect and log in 
    Sftp client = new Sftp();
    client.Connect(hostname);
    client.Login(username, password);
    
    // download the 'test.zip' file from the current directory at the server 
    client.GetFile("test.zip", @"c:\data\test.zip");
    
    // download the 'index.html' file from the specified directory at the server 
    client.GetFile("/wwwroot/index.html", @"c:\data\index.html");
    
    // download the content of '/wwwroot' directory and all subdirectories 
    // at the server to the 'c:\data' directory 
    client.GetFiles("/wwwroot/*", @"c:\data", SftpBatchTransferOptions.Recursive);
    
    client.Disconnect();





    Filed under:
Page 1 of 1 (2 items)