5

I'm writing an application that allows me to up- and download files from a remote server. I'm using sftp as my transfer protocol and i need to list all files and directory's into a listview. I'm using sharpssh for sftp. Can somebody point me into the right direction?

Thanks in forward,

Bas van Ooyen

Bash
  • 53
  • 1
  • 1
  • 4

1 Answers1

13
Sftp sftp = new Sftp(serverUri.Host, userName, password);

sftp.Connect();

//the foldername cannot be empty, or the listing will not show
ArrayList res = sftp.GetFileList("/foldername");
foreach (var item in res)
{
    if (item.ToString() != "." && item.ToString() != "..")
        Console.WriteLine(item.ToString());
}

sftp.Close();
Gabriel Guimarães
  • 2,724
  • 3
  • 27
  • 41
  • 1
    I basically did the same thing... I'm working on updating some of the SharpSSH code that we use at https://bitbucket.org/mattgwagner/sharpssh – MattGWagner Apr 19 '11 at 13:48