The Sftp type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Sftp |
Initializes a new instance of the Sftp class.
|
Methods
Name | Description | |||||
---|---|---|---|---|---|---|
AbortTransfer()()()() |
Aborts all pending file transfers (either file transfer or directory listing).
| |||||
AbortTransfer(Object) |
Aborts pending transfers (either file transfer or directory listing) identified by the specified user-provided state object.
| |||||
BeginBind |
Begins asynchronous Bind operation.
Binds the Sftp object to an underlying SSH session. This makes it possible to run multiple SFTP
sessions over a single SSH session. This can be used instead of Connect(String)/Login(String, String) methods.
| |||||
BeginConnect(String, AsyncCallback, Object) |
Begins asynchronous Connect operation.
Connects to the SFTP server.
| |||||
BeginConnect(String, Int32, AsyncCallback, Object) |
Begins asynchronous Connect operation.
Connects to the SFTP server.
| |||||
BeginConnect(String, Int32, SshParameters, AsyncCallback, Object) | Obsolete. | |||||
BeginCreateDirectory |
Begins asynchronous CreateDirectory operation.
Creates a directory on the server.
| |||||
BeginCreateLink |
Begins asynchronous CreateLink operation.
Creates a symbolic link or hard link on the server.
| |||||
BeginCreateSymlink |
Begins asynchronous CreateSymlink operation.
Creates a symbolic link on the server.
| |||||
BeginDelete(FileSet, AsyncCallback, Object) |
Begins asynchronous Delete operation.
Deletes specified files and/or directories on the server.
| |||||
BeginDelete(String, TraversalMode, AsyncCallback, Object) |
Begins asynchronous Delete operation.
Deletes specified files and/or directories on the server. Accepts wildcards.
| |||||
BeginDeleteFile |
Begins asynchronous DeleteFile operation.
Deletes a file on the server.
| |||||
BeginDirectoryExists |
Begins asynchronous DirectoryExists operation.
Detects whether the specified directory exists on the server.
| |||||
BeginDisconnect |
Begins asynchronous Disconnect operation.
Informs the server that the connection is about to close and
terminates the connection.
| |||||
BeginDownload(FileSet, String, TransferMethod, ActionOnExistingFiles, AsyncCallback, Object) |
Begins asynchronous Download operation.
Downloads the specified files and/or directories from the SFTP server to the local directory.
| |||||
BeginDownload(String, String, TraversalMode, TransferMethod, ActionOnExistingFiles, AsyncCallback, Object) |
Begins asynchronous Download operation.
Downloads the specified file or directory hierarchy from the SFTP server to the local directory. Accepts wildcards.
| |||||
BeginFileExists |
Begins asynchronous FileExists operation.
Detects whether the specified file exists on the server.
| |||||
BeginGetFile(String, Stream, AsyncCallback, Object) |
Begins asynchronous GetFile operation.
Downloads the remote file to the data stream.
| |||||
BeginGetFile(String, String, AsyncCallback, Object) |
Begins asynchronous GetFile operation.
Downloads the remote file to the local file, overriding it if it already exists.
| |||||
BeginGetFile(String, Stream, Int64, Int64, AsyncCallback, Object) |
Begins asynchronous GetFile operation.
Downloads the specified part of the remote file to the data stream.
| |||||
BeginGetFile(String, String, Int64, Int64, Int64, AsyncCallback, Object) |
Begins asynchronous GetFile operation.
Downloads the specified part of the remote file to the specified offset of the local file.
| |||||
BeginGetFileDateTime |
Begins asynchronous GetFileDateTime operation.
Retrieves the modification date and time of the specified remote file.
| |||||
BeginGetFileLength |
Begins asynchronous GetFileLength operation.
Retrieves the size of the specified remote file.
| |||||
BeginGetFiles | Obsolete. | |||||
BeginGetFileSystemInfo |
Begins asynchronous GetFileSystemInfo operation.
Gets drive information (such as free disk space) for the specified path.
| |||||
BeginGetChecksum(String, ChecksumAlgorithm, AsyncCallback, Object) |
Begins asynchronous GetChecksum operation.
Returns the checksum of the specified file on the server. Only works on servers that support the
| |||||
BeginGetChecksum(String, ChecksumAlgorithm, Int64, Int64, AsyncCallback, Object) |
Begins asynchronous GetChecksum operation.
Returns the checksum of the specified file on the server. Only works on servers that support the
| |||||
BeginGetInfo |
Begins asynchronous GetInfo operation.
Retrieves a SftpItem containing the information about the specified remote file or directory.
| |||||
BeginGetItems(FileSet, AsyncCallback, Object) |
Begins asynchronous GetItems operation.
Retrieves the list of files and directories specified by the set.
| |||||
BeginGetItems(String, TraversalMode, AsyncCallback, Object) |
Begins asynchronous GetItems operation.
Retrieves the list of files and directories.
| |||||
BeginGetList(AsyncCallback, Object) |
Begins asynchronous GetList operation.
Retrieves the list of files and directories in the current remote directory.
| |||||
BeginGetList(String, AsyncCallback, Object) |
Begins asynchronous GetList operation.
Retrieves the list of files and directories in the specified remote directory, or a list of files matching the specified mask.
| |||||
BeginGetNameList(AsyncCallback, Object) |
Begins asynchronous GetNameList operation.
Retrieves the list of file and directory names in the current remote directory.
| |||||
BeginGetNameList(String, AsyncCallback, Object) |
Begins asynchronous GetNameList operation.
Retrieves the list of file and directory names in the specified remote directory, or a list of names matching the specified mask.
| |||||
BeginGetRawList(AsyncCallback, Object) |
Begins asynchronous GetRawList operation.
Retrieves the list of files and directories in the current remote directory using a raw text format.
| |||||
BeginGetRawList(String, AsyncCallback, Object) |
Begins asynchronous GetRawList operation.
Retrieves the list of files and directories in the specified remote directory (or a list of files matching the specified mask) using a raw text format.
| |||||
BeginGetStream(String, FileMode, AsyncCallback, Object) |
Begins asynchronous GetStream operation.
Returns a Stream for reading and writing data from the remote file.
| |||||
BeginGetStream(String, FileMode, FileAccess, AsyncCallback, Object) |
Begins asynchronous GetStream operation.
Returns a Stream for reading data from the remote file.
| |||||
BeginChangeDirectory |
Begins asynchronous ChangeDirectory operation.
Changes the current working directory on the server.
| |||||
BeginKeepAlive |
Begins asynchronous KeepAlive operation.
Sends an SSH 'ignore' packet to the server. This can be used to keep firewalls or routers that don't like inactive connection from closing idle session.
| |||||
BeginLogin(AsyncCallback, Object) |
Begins asynchronous Login operation.
Authenticates the user to the server interactively and initializes the SFTP session.
Uses AuthenticationRequest event to request credentials.
| |||||
BeginLogin(String, AsyncCallback, Object) |
Begins asynchronous Login operation.
Authenticates the user to the server interactively and initializes the SFTP session.
Uses AuthenticationRequest event to request credentials.
| |||||
BeginLogin(SshGssApiCredentials, AsyncCallback, Object) |
Begins asynchronous Login operation.
Authenticates to the server using GSSAPI.
Kerberos is only supported on Mono.
NTLM is supported on Windows and partially on Mono.
| |||||
BeginLogin(String, SshPrivateKey, AsyncCallback, Object) |
Begins asynchronous Login operation.
Authenticates the user to the server using his private key and initializes the SFTP session.
| |||||
BeginLogin(String, String, AsyncCallback, Object) |
Begins asynchronous Login operation.
Authenticates the user to the server and initializes the SFTP session.
| |||||
BeginLogin(String, String, SshPrivateKey, AsyncCallback, Object) |
Begins asynchronous Login operation.
Authenticates the user to the server using a combination of password and public key and initializes the SFTP session.
| |||||
BeginPutFile(Stream, String, AsyncCallback, Object) |
Begins asynchronous PutFile operation.
Uploads the content of the data stream to the file on the server, overriding it if it already exists.
| |||||
BeginPutFile(String, String, AsyncCallback, Object) |
Begins asynchronous PutFile operation.
Uploads the content of the local file to the file on the server, overriding it if it already exists.
| |||||
BeginPutFile(Stream, String, Int64, Int64, AsyncCallback, Object) |
Begins asynchronous PutFile operation.
Uploads the content of the data stream to the specified offset of the file on the SFTP server.
| |||||
BeginPutFile(String, String, Int64, Int64, Int64, AsyncCallback, Object) |
Begins asynchronous PutFile operation.
Uploads the specified part of the local file to the specified offset of the file on the SFTP server.
| |||||
BeginPutFiles | Obsolete. | |||||
BeginRemoveDirectory |
Begins asynchronous RemoveDirectory operation.
Deletes an empty remote directory with the specified pathname.
| |||||
BeginRename |
Begins asynchronous Rename operation.
Renames or moves a file or directory on the server.
| |||||
BeginResolveSymlink |
Begins asynchronous ResolveSymlink operation.
Resolves the symlink and returns the real path.
| |||||
BeginSetAttributes |
Begins asynchronous SetAttributes operation.
Sets the attributes of the remote file.
| |||||
BeginSetFileDateTime |
Begins asynchronous SetFileDateTime operation.
Sets the modification date and time of the specified remote file.
| |||||
BeginUpload(FileSet, String, TransferMethod, ActionOnExistingFiles, AsyncCallback, Object) |
Begins asynchronous Upload operation.
Uploads the specified local files and/or directories to the directory to the SFTP server.
| |||||
BeginUpload(String, String, TraversalMode, TransferMethod, ActionOnExistingFiles, AsyncCallback, Object) |
Begins asynchronous Upload operation.
Uploads the specified local file or directory hierarchy to the directory to the SFTP server. Accepts wildcards.
| |||||
Bind(ISocket) |
Binds the Sftp object to an underlying stream socket. This method is experimental and intended for advanced users.
| |||||
Bind(SshSession) |
Binds the Sftp object to an underlying SSH session. This makes it possible to run multiple SFTP
sessions over a single SSH session. This can be used instead of Connect(String)/Login(String, String) methods.
| |||||
Connect(String) |
Connects to the SFTP server.
| |||||
Connect(String, Int32) |
Connects to the SFTP server.
| |||||
Connect(String, Int32, SshParameters) | Obsolete. | |||||
CreateDirectory |
Creates a directory on the server.
| |||||
CreateLink |
Creates a symbolic link or hard link on the server.
| |||||
CreateSymlink |
Creates a symbolic link on the server.
| |||||
Delete(FileSet) |
Deletes specified files and/or directories on the server.
| |||||
Delete(String, TraversalMode) |
Deletes specified files and/or directories on the server. Accepts wildcards.
| |||||
DeleteFile |
Deletes a file on the server.
| |||||
DirectoryExists |
Detects whether the specified directory exists on the server.
| |||||
Disconnect |
Informs the server that the connection is about to close and
terminates the connection.
| |||||
Dispose()()()() |
Disposes the Sftp object and the underlying SSH object.
| |||||
Dispose(Boolean) |
Releases the unmanaged resources used by the Sftp
and optionally releases the managed resources.
| |||||
Download(String, String) |
Downloads the specified file or directory hierarchy from the SFTP server to the local directory. Accepts wildcards.
| |||||
Download(FileSet, String) |
Downloads the specified files and/or directories from the SFTP server to the local directory.
| |||||
Download(String, String, TraversalMode) |
Downloads the specified file or directory hierarchy from the SFTP server to the local directory. Accepts wildcards.
| |||||
Download(FileSet, String, TransferMethod, ActionOnExistingFiles) |
Downloads the specified files and/or directories from the SFTP server to the local directory.
| |||||
Download(String, String, TraversalMode, TransferMethod, ActionOnExistingFiles) |
Downloads the specified file or directory hierarchy from the SFTP server to the local directory. Accepts wildcards.
| |||||
EndBind |
Ends an asynchronous BeginBind operation.
| |||||
EndConnect |
Ends an asynchronous BeginConnect operation.
| |||||
EndCreateDirectory |
Ends an asynchronous BeginCreateDirectory operation.
| |||||
EndCreateLink |
Ends an asynchronous BeginCreateLink operation.
| |||||
EndCreateSymlink |
Ends an asynchronous BeginCreateSymlink operation.
| |||||
EndDelete |
Ends an asynchronous BeginDelete operation.
| |||||
EndDeleteFile |
Ends an asynchronous BeginDeleteFile operation.
| |||||
EndDirectoryExists |
Ends an asynchronous BeginDirectoryExists operation.
| |||||
EndDisconnect |
Ends an asynchronous BeginDisconnect operation.
| |||||
EndDownload |
Ends an asynchronous BeginDownload operation.
| |||||
EndFileExists |
Ends an asynchronous BeginFileExists operation.
| |||||
EndGetFile |
Ends an asynchronous BeginGetFile operation.
| |||||
EndGetFileDateTime |
Ends an asynchronous BeginGetFileDateTime operation.
| |||||
EndGetFileLength |
Ends an asynchronous BeginGetFileLength operation.
| |||||
EndGetFiles | Obsolete. | |||||
EndGetFileSystemInfo |
Ends an asynchronous BeginGetFileSystemInfo operation.
| |||||
EndGetChecksum |
Ends an asynchronous BeginGetChecksum operation.
| |||||
EndGetInfo |
Ends an asynchronous BeginGetInfo operation.
| |||||
EndGetItems |
Ends an asynchronous BeginGetItems operation.
| |||||
EndGetList |
Ends an asynchronous BeginGetList operation.
| |||||
EndGetNameList |
Ends an asynchronous BeginGetNameList operation.
| |||||
EndGetRawList |
Ends an asynchronous BeginGetRawList operation.
| |||||
EndGetStream |
Ends an asynchronous BeginGetStream operation.
| |||||
EndChangeDirectory |
Ends an asynchronous BeginChangeDirectory operation.
| |||||
EndKeepAlive |
Ends an asynchronous BeginKeepAlive operation.
| |||||
EndLogin |
Ends an asynchronous BeginLogin operation.
| |||||
EndPutFile |
Ends an asynchronous BeginPutFile operation.
| |||||
EndPutFiles | Obsolete. | |||||
EndRemoveDirectory |
Ends an asynchronous BeginRemoveDirectory operation.
| |||||
EndRename |
Ends an asynchronous BeginRename operation.
| |||||
EndResolveSymlink |
Ends an asynchronous BeginResolveSymlink operation.
| |||||
EndSetAttributes |
Ends an asynchronous BeginSetAttributes operation.
| |||||
EndSetFileDateTime |
Ends an asynchronous BeginSetFileDateTime operation.
| |||||
EndUpload |
Ends an asynchronous BeginUpload operation.
| |||||
Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |||||
FileExists |
Detects whether the specified file exists on the server.
| |||||
Finalize |
Finalizer. Called by garbage collector during object destruction.
(Overrides Object..::..Finalize()()()().) | |||||
GetConnectionState |
Checks whether the SFTP session is still connected and returns its state.
| |||||
GetCurrentDirectory |
Gets the absolute path of the current working directory on the remote server.
| |||||
GetDownloadStream |
Returns a Stream for reading data from the remote file.
| |||||
GetFile(String, Stream) |
Downloads the remote file to the data stream.
| |||||
GetFile(String, String) |
Downloads the remote file to the local file, overriding it if it already exists.
| |||||
GetFile(String, Stream, Int64, Int64) |
Downloads the specified part of the remote file to the data stream.
| |||||
GetFile(String, String, Int64, Int64, Int64) |
Downloads the specified part of the remote file to the specified offset of the local file.
| |||||
GetFileDateTime |
Retrieves the modification date and time of the specified remote file.
| |||||
GetFileLength |
Retrieves the size of the specified remote file.
| |||||
GetFiles(String, String, SftpBatchTransferOptions) | Obsolete. | |||||
GetFiles(String, String, SftpBatchTransferOptions, SftpActionOnExistingFiles) | Obsolete. | |||||
GetFileSystemInfo |
Gets drive information (such as free disk space) for the specified path.
| |||||
GetHashCode | Serves as a hash function for a particular type. GetHashCode()()()() is suitable for use in hashing algorithms and data structures like a hash table. (Inherited from Object.) | |||||
GetHomeDirectory |
Gets the absolute path of the home directory path of currently logged user.
| |||||
GetChecksum(String, ChecksumAlgorithm) |
Returns the checksum of the specified file on the server. Only works on servers that support the
| |||||
GetChecksum(String, ChecksumAlgorithm, Int64, Int64) |
Returns the checksum of the specified file on the server. Only works on servers that support the
| |||||
GetInfo(String) |
Retrieves a SftpItem containing the information about the specified remote file or directory.
| |||||
GetInfo(String, Boolean) |
Retrieves a SftpItem containing the information about the specified remote file or directory.
| |||||
GetItems(String) |
Retrieves the list of files and directories. Matching directories are searched recursively.
| |||||
GetItems(FileSet) |
Retrieves the list of files and directories specified by the set.
| |||||
GetItems(String, TraversalMode) |
Retrieves the list of files and directories.
| |||||
GetList()()()() |
Retrieves the list of files and directories in the current remote directory.
| |||||
GetList(String) |
Retrieves the list of files and directories in the specified remote directory, or a list of files matching the specified mask.
| |||||
GetNameList()()()() |
Retrieves the list of file and directory names in the current remote directory.
| |||||
GetNameList(String) |
Retrieves the list of file and directory names in the specified remote directory, or a list of names matching the specified mask.
| |||||
GetRawList()()()() |
Retrieves the list of files and directories in the current remote directory using a raw text format.
| |||||
GetRawList(String) |
Retrieves the list of files and directories in the specified remote directory (or a list of files matching the specified mask) using a raw text format.
| |||||
GetStream(String, FileMode) |
Returns a Stream for reading and writing data from the remote file.
| |||||
GetStream(String, FileMode, FileAccess) |
Returns a Stream for reading data from the remote file.
| |||||
GetType | Gets the Type of the current instance. (Inherited from Object.) | |||||
GetUploadStream |
Returns a Stream for writing data to the remote file.
The remote file is created if it doesn't exist, and truncated if it does.
Use GetStream(String, FileMode) method if different behavior is desired.
| |||||
ChangeDirectory |
Changes the current working directory on the server.
| |||||
CheckConnectionState |
Checks whether the SFTP session is still connected. Throws an exception on error.
| |||||
KeepAlive |
Sends an SSH 'ignore' packet to the server. This can be used to keep firewalls or routers that don't like inactive connection from closing idle session.
| |||||
Login()()()() |
Authenticates the user to the server interactively and initializes the SFTP session.
Uses AuthenticationRequest event to request credentials.
| |||||
Login(String) |
Authenticates the user to the server interactively and initializes the SFTP session.
Uses AuthenticationRequest event to request credentials.
| |||||
Login(SshGssApiCredentials) |
Authenticates to the server using GSSAPI.
Kerberos is only supported on Mono.
NTLM is supported on Windows and partially on Mono.
| |||||
Login(String, SshPrivateKey) |
Authenticates the user to the server using his private key and initializes the SFTP session.
| |||||
Login(String, String) |
Authenticates the user to the server and initializes the SFTP session.
| |||||
Login(String, String, SshPrivateKey) |
Authenticates the user to the server using a combination of password and public key and initializes the SFTP session.
| |||||
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |||||
OnCommandSent |
Raises the CommandSent event.
| |||||
OnResponseRead |
Raises the ResponseRead event.
| |||||
OnStateChanged |
Raises the StateChanged event.
| |||||
OnTransferProgress |
Raises the TransferProgress event.
| |||||
PutFile(Stream, String) |
Uploads the content of the data stream to the file on the server, overriding it if it already exists.
| |||||
PutFile(String, String) |
Uploads the content of the local file to the file on the server, overriding it if it already exists.
| |||||
PutFile(Stream, String, Int64, Int64) |
Uploads the content of the data stream to the specified offset of the file on the SFTP server.
| |||||
PutFile(String, String, Int64, Int64, Int64) |
Uploads the specified part of the local file to the specified offset of the file on the SFTP server.
| |||||
PutFiles(String, String, SftpBatchTransferOptions) | Obsolete. | |||||
PutFiles(String, String, SftpBatchTransferOptions, SftpActionOnExistingFiles) | Obsolete. | |||||
RemoveDirectory |
Deletes an empty remote directory with the specified pathname.
| |||||
Rename |
Renames or moves a file or directory on the server.
| |||||
ResolveSymlink |
Resolves the symlink and returns the real path.
| |||||
SetAttributes |
Sets the attributes of the remote file.
| |||||
SetFileDateTime |
Sets the modification date and time of the specified remote file.
| |||||
SetSocketFactory |
Sets the socket factory to be used to create communication sockets.
| |||||
ToString |
Returns a string representation of this object.
(Overrides Object..::..ToString()()()().) | |||||
Upload(String, String) |
Uploads the specific local file or directory hierarchy to the directory to the SFTP server. Accepts wildcards.
| |||||
Upload(FileSet, String) |
Uploads the specified local files and/or directories to the directory to the SFTP server.
| |||||
Upload(String, String, TraversalMode) |
Uploads the specific local file or directory hierarchy to the directory to the SFTP server. Accepts wildcards.
| |||||
Upload(FileSet, String, TransferMethod, ActionOnExistingFiles) |
Uploads the specified local files and/or directories to the directory to the SFTP server.
| |||||
Upload(String, String, TraversalMode, TransferMethod, ActionOnExistingFiles) |
Uploads the specified local file or directory hierarchy to the directory to the SFTP server. Accepts wildcards.
|
Fields
Name | Description | |
---|---|---|
DefaultPort |
Default SFTP port (22).
|
Properties
Name | Description | |
---|---|---|
Encoding |
Gets or sets the Encoding to use to encode and decode command parameters and server responses.
| |
Fingerprint |
Gets the server public key fingerprint (a SHA-256 hash of the server public key).
| |
InstanceId |
Gets instance ID (intended for logging purposes).
(Inherited from NetworkSession.) | |
IsAuthenticated |
Gets a value indicating whether the session is authenticated.
(Overrides NetworkSession..::..IsAuthenticated.) | |
IsConnected |
Gets a value indicating whether the session is connected.
(Overrides NetworkSession..::..IsConnected.) | |
LocalEndPoint |
Gets the local client EndPoint.
| |
LogWriter |
Gets or sets the LogWriter used by this object.
(Inherited from NetworkSession.) | |
MaxDownloadSpeed |
Gets or sets the maximum allowed download speed, in kilobytes per second. For unlimited speed, set this to zero.
| |
MaxUploadSpeed |
Gets or sets the maximum allowed upload speed, in kilobytes per second. For unlimited speed, set this to zero.
| |
Options | Obsolete. | |
ProtocolVersion |
Gets the SFTP protocol version used by this session. This information is only available on fully initialized and authenticated sessions.
| |
Proxy |
Gets or sets the network proxy to use to access a remote server.
| |
RemoteEndPoint |
Gets the remote server EndPoint.
| |
ServerKey |
Gets the server public key.
| |
ServerName |
Gets the server name, if available.
(Inherited from NetworkSession.) | |
ServerPort |
Gets the server port, if available.
(Inherited from NetworkSession.) | |
ServerType |
Gets or sets the server type.
| |
Session |
Gets the SSH session used by this SFTP session.
| |
Settings |
Gets or sets SFTP object settings.
| |
State | ||
Timeout |
Gets or sets the length of time in milliseconds before the operation times out (specify -1 or 0 to indicate that the request does not time out).
| |
TransferType |
Gets or sets the data transfer type. Make sure to set the ServerType property to the target OS first!
| |
UserName |
Gets the authenticated user name, if available.
(Inherited from NetworkSession.) | |
Version |
Gets the version of the SFTP component.
|
Events
Name | Description | |
---|---|---|
AuthenticationRequest |
Occurs when an authentication request is received from the server that cannot be answered programmatically.
| |
BannerReceived |
Occurs when a banner message is received from the server.
| |
BatchTransferProblemDetected | Obsolete. | |
BatchTransferProgress | Obsolete. | |
CommandSent |
Occurs when a command is send to the server.
| |
DeleteProgressChanged |
Occurs when a significant action occurs in Delete method.
Notifies the client about currently processing directory, currently deleting file and progress of the delete.
| |
FingerprintCheck |
Occurs when a fingerprint is received from the server and needs to be validated.
| |
ListItemReceived |
Occurs when a file and directory listing item is received by GetList()()()(), GetRawList()()()(), GetNameList()()()() or GetItems methods.
| |
ProblemDetected | ||
ResponseRead |
Occurs when a response is received from the server.
| |
StateChanged | ||
TransferProgress | Obsolete. | |
TransferProgressChanged | ||
Traversing |