I wrote a application in C# that uses System.IO.GetDirectoires()
and System.IO.GetFiles()
I now have to convert that to use SFTP. I have experience with PutFiles
and GetFiles
of WinSCP .NET assembly, but I cannot figure out how to get a list of directories. There is a GetFiles
in the winscp.exe that I can use for the files but there is no way to get the directories as far as I can tell. Does anyone have a way to do this or is there a library that is easier to work with.
// Setup session options
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = "example.com",
UserName = "user",
Password = "mypassword",
SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
};
using (Session session = new Session())
{
// Connect
session.Open(sessionOptions);
}