C# Class Renci.SshNet.SftpClient

Inheritance: BaseClient
Afficher le fichier Open project: sshnet/SSH.NET Class Usage Examples

Méthodes publiques

Méthode Description
AppendAllLines ( string path, IEnumerable contents ) : void

Appends lines to a file, and closes the file.

AppendAllLines ( string path, IEnumerable contents, Encoding encoding ) : void

Appends lines to a file by using a specified encoding, and closes the file.

AppendAllText ( string path, string contents ) : void

Appends the specified string to the file, and closes the file.

AppendAllText ( string path, string contents, Encoding encoding ) : void

Appends the specified string to the file, and closes the file.

AppendText ( string path ) : StreamWriter

Creates a StreamWriter that appends UTF-8 encoded text to an existing file.

AppendText ( string path, Encoding encoding ) : StreamWriter

Creates a StreamWriter that appends text to an existing file using the specified encoding.

BeginDownloadFile ( string path, Stream output ) : IAsyncResult

Begins an asynchronous file downloading into the stream.

Method calls made by this method to output, may under certain conditions result in exceptions thrown by the stream.

BeginDownloadFile ( string path, Stream output, AsyncCallback asyncCallback ) : IAsyncResult

Begins an asynchronous file downloading into the stream.

Method calls made by this method to output, may under certain conditions result in exceptions thrown by the stream.

BeginDownloadFile ( string path, Stream output, AsyncCallback asyncCallback, object state, Action downloadCallback = null ) : IAsyncResult

Begins an asynchronous file downloading into the stream.

Method calls made by this method to output, may under certain conditions result in exceptions thrown by the stream.

BeginListDirectory ( string path, AsyncCallback asyncCallback, object state, Action listCallback = null ) : IAsyncResult

Begins an asynchronous operation of retrieving list of files in remote directory.

BeginSynchronizeDirectories ( string sourcePath, string destinationPath, string searchPattern, AsyncCallback asyncCallback, object state ) : IAsyncResult

Begins the synchronize directories.

BeginUploadFile ( Stream input, string path ) : IAsyncResult

Begins an asynchronous uploading the stream into remote file.

Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.

If the remote file already exists, it is overwritten and truncated.

BeginUploadFile ( Stream input, string path, AsyncCallback asyncCallback ) : IAsyncResult

Begins an asynchronous uploading the stream into remote file.

Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.

If the remote file already exists, it is overwritten and truncated.

BeginUploadFile ( Stream input, string path, AsyncCallback asyncCallback, object state, Action uploadCallback = null ) : IAsyncResult

Begins an asynchronous uploading the stream into remote file.

Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.

If the remote file already exists, it is overwritten and truncated.

BeginUploadFile ( Stream input, string path, bool canOverride, AsyncCallback asyncCallback, object state, Action uploadCallback = null ) : IAsyncResult

Begins an asynchronous uploading the stream into remote file.

Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.

When path refers to an existing file, set canOverride to true to overwrite and truncate that file. If canOverride is false, the upload will fail and EndUploadFile(IAsyncResult) will throw an SshException.

ChangeDirectory ( string path ) : void

Changes remote directory to path.

ChangePermissions ( string path, short mode ) : void

Changes permissions of file(s) to specified mode.

Create ( string path ) : SftpFileStream

Creates or overwrites a file in the specified path.

If the target file already exists, it is first truncated to zero bytes.

Create ( string path, int bufferSize ) : SftpFileStream

Creates or overwrites the specified file.

If the target file already exists, it is first truncated to zero bytes.

CreateDirectory ( string path ) : void

Creates remote directory specified by path.

CreateText ( string path ) : StreamWriter

Creates or opens a file for writing UTF-8 encoded text.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

CreateText ( string path, Encoding encoding ) : StreamWriter

Creates or opens a file for writing text using the specified encoding.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

Delete ( string path ) : void

Deletes the specified file or directory.

DeleteDirectory ( string path ) : void

Deletes remote directory specified by path.

DeleteFile ( string path ) : void

Deletes remote file specified by path.

DownloadFile ( string path, Stream output, Action downloadCallback = null ) : void

Downloads remote file specified by the path into the stream.

Method calls made by this method to output, may under certain conditions result in exceptions thrown by the stream.

EndDownloadFile ( IAsyncResult asyncResult ) : void

Ends an asynchronous file downloading into the stream.

EndListDirectory ( IAsyncResult asyncResult ) : IEnumerable

Ends an asynchronous operation of retrieving list of files in remote directory.

EndSynchronizeDirectories ( IAsyncResult asyncResult ) : IEnumerable

Ends the synchronize directories.

EndUploadFile ( IAsyncResult asyncResult ) : void

Ends an asynchronous uploading the stream into remote file.

Exists ( string path ) : bool

Checks whether file or directory exists;

Get ( string path ) : SftpFile

Gets reference to remote file or directory.

GetAttributes ( string path ) : SftpFileAttributes

Gets the SftpFileAttributes of the file on the path.

GetLastAccessTime ( string path ) : DateTime

Returns the date and time the specified file or directory was last accessed.

GetLastAccessTimeUtc ( string path ) : DateTime

Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last accessed.

GetLastWriteTime ( string path ) : DateTime

Returns the date and time the specified file or directory was last written to.

GetLastWriteTimeUtc ( string path ) : DateTime

Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last written to.

GetStatus ( string path ) : SftpFileSytemInformation

Gets status using [email protected] request.

ListDirectory ( string path, Action listCallback = null ) : IEnumerable

Retrieves list of files in remote directory.

Open ( string path, FileMode mode ) : SftpFileStream

Opens a SftpFileStream on the specified path with read/write access.

Open ( string path, FileMode mode, FileAccess access ) : SftpFileStream

Opens a SftpFileStream on the specified path, with the specified mode and access.

OpenRead ( string path ) : SftpFileStream

Opens an existing file for reading.

OpenText ( string path ) : StreamReader

Opens an existing UTF-8 encoded text file for reading.

OpenWrite ( string path ) : SftpFileStream

Opens a file for writing.

If the file does not exist, it is created.

ReadAllBytes ( string path ) : byte[]

Opens a binary file, reads the contents of the file into a byte array, and closes the file.

ReadAllLines ( string path ) : string[]

Opens a text file, reads all lines of the file using UTF-8 encoding, and closes the file.

ReadAllLines ( string path, Encoding encoding ) : string[]

Opens a file, reads all lines of the file with the specified encoding, and closes the file.

ReadAllText ( string path ) : string

Opens a text file, reads all lines of the file with the UTF-8 encoding, and closes the file.

ReadAllText ( string path, Encoding encoding ) : string

Opens a file, reads all lines of the file with the specified encoding, and closes the file.

ReadLines ( string path ) : IEnumerable

Reads the lines of a file with the UTF-8 encoding.

ReadLines ( string path, Encoding encoding ) : IEnumerable

Read the lines of a file that has a specified encoding.

RenameFile ( string oldPath, string newPath ) : void

Renames remote file from old path to new path.

RenameFile ( string oldPath, string newPath, bool isPosix ) : void

Renames remote file from old path to new path.

SetAttributes ( string path, SftpFileAttributes fileAttributes ) : void

Sets the specified SftpFileAttributes of the file on the specified path.

SftpClient ( ConnectionInfo connectionInfo ) : System

Initializes a new instance of the SftpClient class.

SftpClient ( string host, string username ) : System

Initializes a new instance of the SftpClient class.

SftpClient ( string host, string username, string password ) : System

Initializes a new instance of the SftpClient class.

SymbolicLink ( string path, string linkPath ) : void

Creates a symbolic link from old path to new path.

SynchronizeDirectories ( string sourcePath, string destinationPath, string searchPattern ) : IEnumerable

Synchronizes the directories.

UploadFile ( Stream input, string path, Action uploadCallback = null ) : void

Uploads stream into remote file.

Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.

UploadFile ( Stream input, string path, bool canOverride, Action uploadCallback = null ) : void

Uploads stream into remote file.

Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.

WriteAllBytes ( string path, byte bytes ) : void

Writes the specified byte array to the specified file, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

WriteAllLines ( string path, IEnumerable contents ) : void

Writes a collection of strings to the file using the UTF-8 encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

WriteAllLines ( string path, IEnumerable contents, Encoding encoding ) : void

Writes a collection of strings to the file using the specified encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

WriteAllLines ( string path, string contents ) : void

Write the specified string array to the file using the UTF-8 encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

WriteAllLines ( string path, string contents, Encoding encoding ) : void

Writes the specified string array to the file by using the specified encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

WriteAllText ( string path, string contents ) : void

Writes the specified string to the file using the UTF-8 encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

WriteAllText ( string path, string contents, Encoding encoding ) : void

Writes the specified string to the file using the specified encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

Méthodes protégées

Méthode Description
Dispose ( bool disposing ) : void

Releases unmanaged and - optionally - managed resources

OnConnected ( ) : void

Called when client is connected to the server.

OnDisconnecting ( ) : void

Called when client is disconnecting from the server.

Private Methods

Méthode Description
InternalDownloadFile ( string path, Stream output, SftpDownloadAsyncResult asyncResult, Action downloadCallback ) : void

Internals the download file.

InternalListDirectory ( string path, Action listCallback ) : IEnumerable

Internals the list directory.

InternalSynchronizeDirectories ( string sourcePath, string destinationPath, string searchPattern, SftpSynchronizeDirectoriesAsyncResult asynchResult ) : IEnumerable
InternalUploadFile ( Stream input, string path, Flags flags, SftpUploadAsyncResult asyncResult, Action uploadCallback ) : void

Internals the upload file.

SetLastAccessTime ( string path, DateTime lastAccessTime ) : void
SetLastAccessTimeUtc ( string path, DateTime lastAccessTimeUtc ) : void
SetLastWriteTime ( string path, DateTime lastWriteTime ) : void
SetLastWriteTimeUtc ( string path, DateTime lastWriteTimeUtc ) : void
SftpClient ( ConnectionInfo connectionInfo, bool ownsConnectionInfo ) : System

Initializes a new instance of the SftpClient class.

If ownsConnectionInfo is true, the connection info will be disposed when this instance is disposed.

SftpClient ( ConnectionInfo connectionInfo, bool ownsConnectionInfo, IServiceFactory serviceFactory ) : System

Initializes a new instance of the SftpClient class.

If ownsConnectionInfo is true, the connection info will be disposed when this instance is disposed.

SftpClient ( string host, int port, string username ) : System
SftpClient ( string host, int port, string username, string password ) : System

Method Details

AppendAllLines() public méthode

Appends lines to a file, and closes the file.
isnull -or- is null. Client is not connected. was not found on the remote host. The method was called after the client was disposed.
public AppendAllLines ( string path, IEnumerable contents ) : void
path string The file to append the lines to. The file is created if it does not already exist.
contents IEnumerable The lines to append to the file.
Résultat void

AppendAllLines() public méthode

Appends lines to a file by using a specified encoding, and closes the file.
is null. -or- is null. -or- is null. Client is not connected. was not found on the remote host. The method was called after the client was disposed.
public AppendAllLines ( string path, IEnumerable contents, Encoding encoding ) : void
path string The file to append the lines to. The file is created if it does not already exist.
contents IEnumerable The lines to append to the file.
encoding System.Text.Encoding The character encoding to use.
Résultat void

AppendAllText() public méthode

Appends the specified string to the file, and closes the file.
is null. -or- is null. Client is not connected. was not found on the remote host. The method was called after the client was disposed.
public AppendAllText ( string path, string contents ) : void
path string The file to append the specified string to.
contents string The string to append to the file.
Résultat void

AppendAllText() public méthode

Appends the specified string to the file, and closes the file.
is null. -or- is null. -or- is null. Client is not connected. was not found on the remote host. The method was called after the client was disposed.
public AppendAllText ( string path, string contents, Encoding encoding ) : void
path string The file to append the specified string to.
contents string The string to append to the file.
encoding System.Text.Encoding The character encoding to use.
Résultat void

AppendText() public méthode

Creates a StreamWriter that appends UTF-8 encoded text to an existing file.
is null. Client is not connected. was not found on the remote host. The method was called after the client was disposed.
public AppendText ( string path ) : StreamWriter
path string The path to the file to append to.
Résultat System.IO.StreamWriter

AppendText() public méthode

Creates a StreamWriter that appends text to an existing file using the specified encoding.
is null. -or- is null. Client is not connected. was not found on the remote host. The method was called after the client was disposed.
public AppendText ( string path, Encoding encoding ) : StreamWriter
path string The path to the file to append to.
encoding System.Text.Encoding The character encoding to use.
Résultat System.IO.StreamWriter

BeginDownloadFile() public méthode

Begins an asynchronous file downloading into the stream.
Method calls made by this method to output, may under certain conditions result in exceptions thrown by the stream.
is null. is null or contains only whitespace characters. Client is not connected. Permission to perform the operation was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public BeginDownloadFile ( string path, Stream output ) : IAsyncResult
path string The path.
output Stream The output.
Résultat IAsyncResult

BeginDownloadFile() public méthode

Begins an asynchronous file downloading into the stream.
Method calls made by this method to output, may under certain conditions result in exceptions thrown by the stream.
is null. is null or contains only whitespace characters. Client is not connected. Permission to perform the operation was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public BeginDownloadFile ( string path, Stream output, AsyncCallback asyncCallback ) : IAsyncResult
path string The path.
output Stream The output.
asyncCallback AsyncCallback The method to be called when the asynchronous write operation is completed.
Résultat IAsyncResult

BeginDownloadFile() public méthode

Begins an asynchronous file downloading into the stream.
Method calls made by this method to output, may under certain conditions result in exceptions thrown by the stream.
is null. is null or contains only whitespace characters. The method was called after the client was disposed.
public BeginDownloadFile ( string path, Stream output, AsyncCallback asyncCallback, object state, Action downloadCallback = null ) : IAsyncResult
path string The path.
output Stream The output.
asyncCallback AsyncCallback The method to be called when the asynchronous write operation is completed.
state object A user-provided object that distinguishes this particular asynchronous write request from other requests.
downloadCallback Action The download callback.
Résultat IAsyncResult

BeginListDirectory() public méthode

Begins an asynchronous operation of retrieving list of files in remote directory.
The method was called after the client was disposed.
public BeginListDirectory ( string path, AsyncCallback asyncCallback, object state, Action listCallback = null ) : IAsyncResult
path string The path.
asyncCallback AsyncCallback The method to be called when the asynchronous write operation is completed.
state object A user-provided object that distinguishes this particular asynchronous write request from other requests.
listCallback Action The list callback.
Résultat IAsyncResult

BeginSynchronizeDirectories() public méthode

Begins the synchronize directories.
is null. is null or contains only whitespace.
public BeginSynchronizeDirectories ( string sourcePath, string destinationPath, string searchPattern, AsyncCallback asyncCallback, object state ) : IAsyncResult
sourcePath string The source path.
destinationPath string The destination path.
searchPattern string The search pattern.
asyncCallback AsyncCallback The async callback.
state object The state.
Résultat IAsyncResult

BeginUploadFile() public méthode

Begins an asynchronous uploading the stream into remote file.

Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.

If the remote file already exists, it is overwritten and truncated.

is null. is null or contains only whitespace characters. Client is not connected. Permission to list the contents of the directory was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public BeginUploadFile ( Stream input, string path ) : IAsyncResult
input Stream Data input stream.
path string Remote file path.
Résultat IAsyncResult

BeginUploadFile() public méthode

Begins an asynchronous uploading the stream into remote file.

Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.

If the remote file already exists, it is overwritten and truncated.

is null. is null or contains only whitespace characters. Client is not connected. Permission to list the contents of the directory was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public BeginUploadFile ( Stream input, string path, AsyncCallback asyncCallback ) : IAsyncResult
input Stream Data input stream.
path string Remote file path.
asyncCallback AsyncCallback The method to be called when the asynchronous write operation is completed.
Résultat IAsyncResult

BeginUploadFile() public méthode

Begins an asynchronous uploading the stream into remote file.

Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.

If the remote file already exists, it is overwritten and truncated.

is null. is null or contains only whitespace characters. Client is not connected. Permission to list the contents of the directory was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public BeginUploadFile ( Stream input, string path, AsyncCallback asyncCallback, object state, Action uploadCallback = null ) : IAsyncResult
input Stream Data input stream.
path string Remote file path.
asyncCallback AsyncCallback The method to be called when the asynchronous write operation is completed.
state object A user-provided object that distinguishes this particular asynchronous write request from other requests.
uploadCallback Action The upload callback.
Résultat IAsyncResult

BeginUploadFile() public méthode

Begins an asynchronous uploading the stream into remote file.

Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.

When path refers to an existing file, set canOverride to true to overwrite and truncate that file. If canOverride is false, the upload will fail and EndUploadFile(IAsyncResult) will throw an SshException.

is null. is null or contains only whitespace characters. The method was called after the client was disposed.
public BeginUploadFile ( Stream input, string path, bool canOverride, AsyncCallback asyncCallback, object state, Action uploadCallback = null ) : IAsyncResult
input Stream Data input stream.
path string Remote file path.
canOverride bool Specified whether an existing file can be overwritten.
asyncCallback AsyncCallback The method to be called when the asynchronous write operation is completed.
state object A user-provided object that distinguishes this particular asynchronous write request from other requests.
uploadCallback Action The upload callback.
Résultat IAsyncResult

ChangeDirectory() public méthode

Changes remote directory to path.
is null. Client is not connected. Permission to change directory denied by remote host. -or- A SSH command was denied by the server. was not found on the remote host. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public ChangeDirectory ( string path ) : void
path string New directory path.
Résultat void

ChangePermissions() public méthode

Changes permissions of file(s) to specified mode.
is null. Client is not connected. Permission to change permission on the path(s) was denied by the remote host. -or- A SSH command was denied by the server. was not found on the remote host. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public ChangePermissions ( string path, short mode ) : void
path string File(s) path, may match multiple files.
mode short The mode.
Résultat void

Create() public méthode

Creates or overwrites a file in the specified path.
If the target file already exists, it is first truncated to zero bytes.
is null. Client is not connected. The method was called after the client was disposed.
public Create ( string path ) : SftpFileStream
path string The path and name of the file to create.
Résultat Renci.SshNet.Sftp.SftpFileStream

Create() public méthode

Creates or overwrites the specified file.
If the target file already exists, it is first truncated to zero bytes.
is null. Client is not connected. The method was called after the client was disposed.
public Create ( string path, int bufferSize ) : SftpFileStream
path string The path and name of the file to create.
bufferSize int The maximum number of bytes buffered for reads and writes to the file.
Résultat Renci.SshNet.Sftp.SftpFileStream

CreateDirectory() public méthode

Creates remote directory specified by path.
is null or contains only whitespace characters. Client is not connected. Permission to create the directory was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public CreateDirectory ( string path ) : void
path string Directory path to create.
Résultat void

CreateText() public méthode

Creates or opens a file for writing UTF-8 encoded text.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

is null. Client is not connected. The method was called after the client was disposed.
public CreateText ( string path ) : StreamWriter
path string The file to be opened for writing.
Résultat System.IO.StreamWriter

CreateText() public méthode

Creates or opens a file for writing text using the specified encoding.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

is null. Client is not connected. The method was called after the client was disposed.
public CreateText ( string path, Encoding encoding ) : StreamWriter
path string The file to be opened for writing.
encoding Encoding The character encoding to use.
Résultat StreamWriter

Delete() public méthode

Deletes the specified file or directory.
is null. Client is not connected. was not found on the remote host. The method was called after the client was disposed.
public Delete ( string path ) : void
path string The name of the file or directory to be deleted. Wildcard characters are not supported.
Résultat void

DeleteDirectory() public méthode

Deletes remote directory specified by path.
is null or contains only whitespace characters. Client is not connected. was not found on the remote host. Permission to delete the directory was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public DeleteDirectory ( string path ) : void
path string Directory to be deleted path.
Résultat void

DeleteFile() public méthode

Deletes remote file specified by path.
is null or contains only whitespace characters. Client is not connected. was not found on the remote host. Permission to delete the file was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public DeleteFile ( string path ) : void
path string File to be deleted path.
Résultat void

Dispose() protected méthode

Releases unmanaged and - optionally - managed resources
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; false to release only unmanaged resources.
Résultat void

DownloadFile() public méthode

Downloads remote file specified by the path into the stream.
Method calls made by this method to output, may under certain conditions result in exceptions thrown by the stream.
is null. is null or contains only whitespace characters. Client is not connected. Permission to perform the operation was denied by the remote host. -or- A SSH command was denied by the server. was not found on the remote host. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public DownloadFile ( string path, Stream output, Action downloadCallback = null ) : void
path string File to download.
output Stream Stream to write the file into.
downloadCallback Action The download callback.
Résultat void

EndDownloadFile() public méthode

Ends an asynchronous file downloading into the stream.
The object did not come from the corresponding async method on this type.-or- was called multiple times with the same . Client is not connected. Permission to perform the operation was denied by the remote host. -or- A SSH command was denied by the server. The path was not found on the remote host. A SSH error where is the message from the remote host.
public EndDownloadFile ( IAsyncResult asyncResult ) : void
asyncResult IAsyncResult The pending asynchronous SFTP request.
Résultat void

EndListDirectory() public méthode

Ends an asynchronous operation of retrieving list of files in remote directory.
The object did not come from the corresponding async method on this type.-or- was called multiple times with the same .
public EndListDirectory ( IAsyncResult asyncResult ) : IEnumerable
asyncResult IAsyncResult The pending asynchronous SFTP request.
Résultat IEnumerable

EndSynchronizeDirectories() public méthode

Ends the synchronize directories.
The object did not come from the corresponding async method on this type.-or- was called multiple times with the same . The destination path was not found on the remote host.
public EndSynchronizeDirectories ( IAsyncResult asyncResult ) : IEnumerable
asyncResult IAsyncResult The async result.
Résultat IEnumerable

EndUploadFile() public méthode

Ends an asynchronous uploading the stream into remote file.
The object did not come from the corresponding async method on this type.-or- was called multiple times with the same . Client is not connected. The directory of the file was not found on the remote host. Permission to upload the file was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host.
public EndUploadFile ( IAsyncResult asyncResult ) : void
asyncResult IAsyncResult The pending asynchronous SFTP request.
Résultat void

Exists() public méthode

Checks whether file or directory exists;
is null or contains only whitespace characters. Client is not connected. Permission to perform the operation was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public Exists ( string path ) : bool
path string The path.
Résultat bool

Get() public méthode

Gets reference to remote file or directory.
Client is not connected. was not found on the remote host. is null. The method was called after the client was disposed.
public Get ( string path ) : SftpFile
path string The path.
Résultat SftpFile

GetAttributes() public méthode

Gets the SftpFileAttributes of the file on the path.
is null. Client is not connected. was not found on the remote host. The method was called after the client was disposed.
public GetAttributes ( string path ) : SftpFileAttributes
path string The path to the file.
Résultat SftpFileAttributes

GetLastAccessTime() public méthode

Returns the date and time the specified file or directory was last accessed.
is null. Client is not connected. The method was called after the client was disposed.
public GetLastAccessTime ( string path ) : DateTime
path string The file or directory for which to obtain access date and time information.
Résultat DateTime

GetLastAccessTimeUtc() public méthode

Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last accessed.
is null. Client is not connected. The method was called after the client was disposed.
public GetLastAccessTimeUtc ( string path ) : DateTime
path string The file or directory for which to obtain access date and time information.
Résultat DateTime

GetLastWriteTime() public méthode

Returns the date and time the specified file or directory was last written to.
is null. Client is not connected. The method was called after the client was disposed.
public GetLastWriteTime ( string path ) : DateTime
path string The file or directory for which to obtain write date and time information.
Résultat DateTime

GetLastWriteTimeUtc() public méthode

Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last written to.
is null. Client is not connected. The method was called after the client was disposed.
public GetLastWriteTimeUtc ( string path ) : DateTime
path string The file or directory for which to obtain write date and time information.
Résultat DateTime

GetStatus() public méthode

Gets status using [email protected] request.
Client is not connected. is null. The method was called after the client was disposed.
public GetStatus ( string path ) : SftpFileSytemInformation
path string The path.
Résultat SftpFileSytemInformation

ListDirectory() public méthode

Retrieves list of files in remote directory.
is null. Client is not connected. Permission to list the contents of the directory was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public ListDirectory ( string path, Action listCallback = null ) : IEnumerable
path string The path.
listCallback Action The list callback.
Résultat IEnumerable

OnConnected() protected méthode

Called when client is connected to the server.
protected OnConnected ( ) : void
Résultat void

OnDisconnecting() protected méthode

Called when client is disconnecting from the server.
protected OnDisconnecting ( ) : void
Résultat void

Open() public méthode

Opens a SftpFileStream on the specified path with read/write access.
is null. Client is not connected. The method was called after the client was disposed.
public Open ( string path, FileMode mode ) : SftpFileStream
path string The file to open.
mode FileMode A value that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten.
Résultat SftpFileStream

Open() public méthode

Opens a SftpFileStream on the specified path, with the specified mode and access.
is null. Client is not connected. The method was called after the client was disposed.
public Open ( string path, FileMode mode, FileAccess access ) : SftpFileStream
path string The file to open.
mode FileMode A value that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten.
access FileAccess A value that specifies the operations that can be performed on the file.
Résultat SftpFileStream

OpenRead() public méthode

Opens an existing file for reading.
is null. Client is not connected. The method was called after the client was disposed.
public OpenRead ( string path ) : SftpFileStream
path string The file to be opened for reading.
Résultat SftpFileStream

OpenText() public méthode

Opens an existing UTF-8 encoded text file for reading.
is null. Client is not connected. The method was called after the client was disposed.
public OpenText ( string path ) : StreamReader
path string The file to be opened for reading.
Résultat StreamReader

OpenWrite() public méthode

Opens a file for writing.
If the file does not exist, it is created.
is null. Client is not connected. The method was called after the client was disposed.
public OpenWrite ( string path ) : SftpFileStream
path string The file to be opened for writing.
Résultat SftpFileStream

ReadAllBytes() public méthode

Opens a binary file, reads the contents of the file into a byte array, and closes the file.
is null. Client is not connected. The method was called after the client was disposed.
public ReadAllBytes ( string path ) : byte[]
path string The file to open for reading.
Résultat byte[]

ReadAllLines() public méthode

Opens a text file, reads all lines of the file using UTF-8 encoding, and closes the file.
is null. Client is not connected. The method was called after the client was disposed.
public ReadAllLines ( string path ) : string[]
path string The file to open for reading.
Résultat string[]

ReadAllLines() public méthode

Opens a file, reads all lines of the file with the specified encoding, and closes the file.
is null. Client is not connected. The method was called after the client was disposed.
public ReadAllLines ( string path, Encoding encoding ) : string[]
path string The file to open for reading.
encoding Encoding The encoding applied to the contents of the file.
Résultat string[]

ReadAllText() public méthode

Opens a text file, reads all lines of the file with the UTF-8 encoding, and closes the file.
is null. Client is not connected. The method was called after the client was disposed.
public ReadAllText ( string path ) : string
path string The file to open for reading.
Résultat string

ReadAllText() public méthode

Opens a file, reads all lines of the file with the specified encoding, and closes the file.
is null. Client is not connected. The method was called after the client was disposed.
public ReadAllText ( string path, Encoding encoding ) : string
path string The file to open for reading.
encoding Encoding The encoding applied to the contents of the file.
Résultat string

ReadLines() public méthode

Reads the lines of a file with the UTF-8 encoding.
is null. Client is not connected. The method was called after the client was disposed.
public ReadLines ( string path ) : IEnumerable
path string The file to read.
Résultat IEnumerable

ReadLines() public méthode

Read the lines of a file that has a specified encoding.
is null. Client is not connected. The method was called after the client was disposed.
public ReadLines ( string path, Encoding encoding ) : IEnumerable
path string The file to read.
encoding Encoding The encoding that is applied to the contents of the file.
Résultat IEnumerable

RenameFile() public méthode

Renames remote file from old path to new path.
is null. -or- or is null. Client is not connected. Permission to rename the file was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public RenameFile ( string oldPath, string newPath ) : void
oldPath string Path to the old file location.
newPath string Path to the new file location.
Résultat void

RenameFile() public méthode

Renames remote file from old path to new path.
is null. -or- or is null. Client is not connected. Permission to rename the file was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public RenameFile ( string oldPath, string newPath, bool isPosix ) : void
oldPath string Path to the old file location.
newPath string Path to the new file location.
isPosix bool if set to true then perform a posix rename.
Résultat void

SetAttributes() public méthode

Sets the specified SftpFileAttributes of the file on the specified path.
is null. Client is not connected. The method was called after the client was disposed.
public SetAttributes ( string path, SftpFileAttributes fileAttributes ) : void
path string The path to the file.
fileAttributes SftpFileAttributes The desired .
Résultat void

SftpClient() public méthode

Initializes a new instance of the SftpClient class.
is null.
public SftpClient ( ConnectionInfo connectionInfo ) : System
connectionInfo ConnectionInfo The connection info.
Résultat System

SftpClient() public méthode

Initializes a new instance of the SftpClient class.
is null. is invalid. -or- is null or contains only whitespace characters.
public SftpClient ( string host, string username ) : System
host string Connection host.
username string Authentication username.
Résultat System

SftpClient() public méthode

Initializes a new instance of the SftpClient class.
is null. is invalid. -or- is null contains only whitespace characters.
public SftpClient ( string host, string username, string password ) : System
host string Connection host.
username string Authentication username.
password string Authentication password.
Résultat System

SymbolicLink() public méthode

Creates a symbolic link from old path to new path.
is null. -or- is null or contains only whitespace characters. Client is not connected. Permission to create the symbolic link was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public SymbolicLink ( string path, string linkPath ) : void
path string The old path.
linkPath string The new path.
Résultat void

SynchronizeDirectories() public méthode

Synchronizes the directories.
is null. is null or contains only whitespace. was not found on the remote host.
public SynchronizeDirectories ( string sourcePath, string destinationPath, string searchPattern ) : IEnumerable
sourcePath string The source path.
destinationPath string The destination path.
searchPattern string The search pattern.
Résultat IEnumerable

UploadFile() public méthode

Uploads stream into remote file.
Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.
is null. is null or contains only whitespace characters. Client is not connected. Permission to upload the file was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public UploadFile ( Stream input, string path, Action uploadCallback = null ) : void
input Stream Data input stream.
path string Remote file path.
uploadCallback Action The upload callback.
Résultat void

UploadFile() public méthode

Uploads stream into remote file.
Method calls made by this method to input, may under certain conditions result in exceptions thrown by the stream.
is null. is null or contains only whitespace characters. Client is not connected. Permission to upload the file was denied by the remote host. -or- A SSH command was denied by the server. A SSH error where is the message from the remote host. The method was called after the client was disposed.
public UploadFile ( Stream input, string path, bool canOverride, Action uploadCallback = null ) : void
input Stream Data input stream.
path string Remote file path.
canOverride bool if set to true then existing file will be overwritten.
uploadCallback Action The upload callback.
Résultat void

WriteAllBytes() public méthode

Writes the specified byte array to the specified file, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

is null. Client is not connected. The method was called after the client was disposed.
public WriteAllBytes ( string path, byte bytes ) : void
path string The file to write to.
bytes byte The bytes to write to the file.
Résultat void

WriteAllLines() public méthode

Writes a collection of strings to the file using the UTF-8 encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

is null. Client is not connected. The method was called after the client was disposed.
public WriteAllLines ( string path, IEnumerable contents ) : void
path string The file to write to.
contents IEnumerable The lines to write to the file.
Résultat void

WriteAllLines() public méthode

Writes a collection of strings to the file using the specified encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

is null. Client is not connected. The method was called after the client was disposed.
public WriteAllLines ( string path, IEnumerable contents, Encoding encoding ) : void
path string The file to write to.
contents IEnumerable The lines to write to the file.
encoding Encoding The character encoding to use.
Résultat void

WriteAllLines() public méthode

Write the specified string array to the file using the UTF-8 encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

is null. Client is not connected. The method was called after the client was disposed.
public WriteAllLines ( string path, string contents ) : void
path string The file to write to.
contents string The string array to write to the file.
Résultat void

WriteAllLines() public méthode

Writes the specified string array to the file by using the specified encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

is null. Client is not connected. The method was called after the client was disposed.
public WriteAllLines ( string path, string contents, Encoding encoding ) : void
path string The file to write to.
contents string The string array to write to the file.
encoding Encoding An object that represents the character encoding applied to the string array.
Résultat void

WriteAllText() public méthode

Writes the specified string to the file using the UTF-8 encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

is null. Client is not connected. The method was called after the client was disposed.
public WriteAllText ( string path, string contents ) : void
path string The file to write to.
contents string The string to write to the file.
Résultat void

WriteAllText() public méthode

Writes the specified string to the file using the specified encoding, and closes the file.

If the target file already exists, it is overwritten. It is not first truncated to zero bytes.

If the target file does not exist, it is created.

is null. Client is not connected. The method was called after the client was disposed.
public WriteAllText ( string path, string contents, Encoding encoding ) : void
path string The file to write to.
contents string The string to write to the file.
encoding Encoding The encoding to apply to the string.
Résultat void