I wrote a C # application that uses System.IO.GetDirectoires() and System.IO.GetFiles()
Now I need to convert this to use SFTP. I have experience with PutFiles and GetFiles of the WinSCP.NET assembly, but I cannot figure out how to get the list of directories. There is GetFiles winscp.exe file, which I can use for files, but there is no way to get directories, as far as I can tell. Does anyone have a way to do this or have 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); }
source share