0

I need to get the list of all the filenames through SFTP with VB. I'm trying to place it in an ArrayList, but unsure on the commands to use..

Public Shared Function Retrieve_Directory_list(ByVal strHost As String, _
                                ByVal strUsername As String, _
                                ByVal strPassword As String, _
                                ByVal strFtpFilePath As String, _
                                ByVal strlocalFilePath As String) As ArrayList)

    Dim sshCp As SshTransferProtocolBase
    Dim res As New ArrayList()

    sshCp = New Sftp(strHost, strUsername, strPassword)

    sshCp.Connect()

'res = sshCp.???


    sshCp.Close()

Return res

End Function

Please let me know if u need anything else. Thanks!

dright
  • 613
  • 1
  • 9
  • 19

2 Answers2

0

I think you want something like:

sshCp.Connect()

Dim result as ArrayList() = sshCp.GetFileList("/foldername")

sshCp.Close()

Return res
Jay
  • 5,897
  • 1
  • 25
  • 28
0

You're probably going to want to look at Tamir.SharpSsh.Sftp.GetFileList(String path) which returns an IEnumerable of objects that represent remote files. It should be able to do what you're looking for.

https://bitbucket.org/mattgwagner/sharpssh/src/260e9d6d1bcf/SharpSSH/Sftp.cs

MattGWagner
  • 1,156
  • 1
  • 10
  • 16