-
-
Notifications
You must be signed in to change notification settings - Fork 4
SSH.ListDirectory
Andrew Lambert edited this page Nov 26, 2022
·
3 revisions
SSH.ListDirectory
Protected Function ListDirectory(Optional Session As SSH.Session, URL As String) As SSH.SFTPDirectory
Name | Type | Comment |
---|---|---|
Session |
Session | Optional. If specified, an active SSH session to use. |
URL |
String | The fully qualified URL to list. |
Returns a SFTPDirectory object that you can use to iterate over the directory.
This convenience method prepares a directory listing over SFTP. If the Session
parameter is specified then only the path part of the URL is used. Raises an exception on error.
This example specifies everything in the URL
Dim lister As SSH.SFTPDirectory = SSH.ListDirectory("sftp://username:password@ssh.example.com:2222/pub/")
Dim names() As String
Do
names.Append(lister.CurrentName)
Loop Until Not lister.ReadNextEntry()
lister.Close()
This example uses an existing session.
Dim session As SSH.Session = SSH.Connect("ssh.example.com", 2222, "username", "password")
Dim lister As SSH.SFTPDirectory = SSH.ListDirectory(session, "/pub/")
Dim names() As String
Do
names.Append(lister.CurrentName)
Loop Until Not lister.ReadNextEntry()
lister.Close()
Wiki home | Project page | Bugs | Become a sponsor
Text and code examples are Copyright ©2018-24 Andrew Lambert, offered under the CC BY-SA 3.0 License.