Hi All,
I need to read all the files from a folder that is available in SFTP server. I am using Renci.SshNet.dll file.
I can able to get the number of files (total count) available in that location by using below code but unable to retrieve the name of the each file present in that location.
SftpClient sftpClient;
SftpFile file;
str host = "example.com";
str username = "example";
str password = "******";
str remoteDirectory = @"path\files";
sftpClient = new SftpClient(host, 22, username, password);
sftpClient.Connect();
sftpClient.ChangeDirectory('..');
str name1 = sftpClient.WorkingDirectory;
sftpClient.ChangeDirectory(remoteDirectory);
str name = sftpClient.WorkingDirectory;
var files = sftpClient.ListDirectory(name,null);
Please suggest on how to read the file name.
Thanks in advance.