-
-
Notifications
You must be signed in to change notification settings - Fork 4
SSH.SFTPDirectory
SSH.SFTPDirectory
Protected Class SFTPDirectory
This class represents a directory listing operation over SFTP.
Create a new instance and then read the CurrentName
, CurrentType
, CurrentLength
, etc. properties to get metadata on the current item in the listing, then call ReadNextEntry()
to load the next item.
If the SuppressVirtualEntries
property is set to True
and the directory is empty then the CurrentType
property will be SFTPEntryType.Unknown
and the CurrentIndex
property will be -1
. If SuppressVirtualEntries
is False
then an empty directory will appear to contain to subdirectories.
- AccessTime As Date
- CurrentAccessTime As Date
- CurrentIndex As Integer
- CurrentLength As UInt64
- CurrentMode As Permissions
- CurrentModifyTime As Date
- CurrentName As String
- CurrentType As SFTPDirectory.EntryType
- FullPath As String
- LastError As Int32
- Mode As Permissions
- ModifyTime As Date
- Name As String
- Parent As SFTPDirectory
- Session As SFTPSession
- SuppressVirtualEntries As Boolean
This example is a console application that prints a file listing for a remote directory.
Dim session As New SSH.Session
If Not session.Connect("ssh.example.com", 22) Then
Print("Connection failed.")
Return 1
End If
If Not session.SendCredentials("username", "password") Then
Print(session.LastErrorMsg)
session.Close
Return 1
End If
Dim sftp As New SSH.SFTPSession(session)
Dim lister As SSH.SFTPDirectory = sftp.ListDirectory("/path/to/directory/")
Do
If lister.CurrentType = SSH.SFTPEntryType.File Then
Print(lister.CurrentName + " (" + Str(lister.CurrentLength) + " bytes)")
Else
Print(lister.CurrentName + " (DIR)")
End If
Loop Until Not lister.ReadNextEntry()
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.