using (var client = new SftpClient("<address>", <port>, <uid>, "<pw>"))
{
client.Connect();
List<Renci.SshNet.Sftp.SftpFile> Files = client.ListDirectory("<ftp file directory>").ToList();
foreach (Renci.SshNet.Sftp.SftpFile CurrentFile in Files)
{
client.Disconnect();
}
Hope this helps.
{
client.Connect();
List<Renci.SshNet.Sftp.SftpFile> Files = client.ListDirectory("<ftp file directory>").ToList();
foreach (Renci.SshNet.Sftp.SftpFile CurrentFile in Files)
{
/// Download into file stream
FileStream fs = new FileStream(Folder + CurrentFile.Name, FileMode.Create);
client.DownloadFile(CurrentFile.Name, fs);
/// Close file stream
fs.Close();
}client.Disconnect();
}
Hope this helps.