-
-
Notifications
You must be signed in to change notification settings - Fork 4
SSH.SFTPSession
SSH.SFTPSession
Protected Class SFTPSessionThis class represents a SSH File Transfer Protocol (SFTP) session. A single SFTPSession can perform multiple simultaneous file operations.
When giving a file or directory name you can specify either an absolute path (i.e. the first character is /) or a path which is relative to the current WorkingDirectory (no leading /). Paths containing .. and . are not supported.
The WorkingDirectory will be initialized to /home/username/ if such a directory actually exists. Otherwise the WorkingDirectory will point to the root directory of the server (/). If you intend to use relative paths then it behooves you to verify that the WorkingDirectory is what you expect it to be.
- Append
- Close
- Constructor
- CreateStream
- CreateSymbolicLink
- Get
- IsDirectory
- IsSymbolicLink
- ListDirectory
- MakeDirectory
- PathExists
- Put
- ReadSymbolicLink
- RemoveDirectory
- RemoveFile
- Rename
- Channel As SSH.Channel
- Handle As Ptr
- LastError As Int32
- LastStatusCode As Int32
- LastStatusName As String
- Session As SSH.Session
- WorkingDirectory As String
This example opens an SFTP session and then creates a directory listing, a download, and an upload over it.
Dim session As SSH.Session = SSH.Connect("ssh.example.com", 22, "username", "password")
Dim sftp As New SSH.SFTPSession(session)
Dim listing As SSH.SFTPDirectory = sftp.ListDirectory("/home/bob/desktop/")
Dim download As SSH.SFTPStream = sftp.Get("/home/bob/desktop/file.txt")
Dim upload As SSH.SFTPStream = sftp.Put("/home/bob/desktop/file2.txt")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.