C# Class CoreTechs.Sftp.Client.Sftp

Wrapper class for 'Renci.SshNet' SFTP client.
Datei anzeigen Open project: Core-Techs/CoreTechs.Sftp.Client

Private Properties

Property Type Description
CreateRemoteDirectory string
CreateSftpClient Renci.SshNet.SftpClient
DoesRemoteFileExist bool
UploadFile void
UploadFile void

Public Methods

Method Description
UploadFile ( string fileName, bool overwrite = false, string remoteDirectoryPath = null ) : void

Upload a file to the SFTP server specified in the public properties.

Assumption: the public properties (Host, Username, Password and Hostkey) have been initialized before calling this method.

UploadFile ( string sftpConnectionString, string fileName, bool overwrite = false, string remoteDirectoryPath = null ) : void

Upload a file to the SFTP server specified in the connection string.

The SFTP connection string is in the form: "username=USERNAME;password=PASSWORD;host=HOSTNAME;hostkey=ssh-dss 1024 9b:3f:14:6a:6f:36:7f:b7:58:f4:e4:89:0d:3f:c2:26".

UploadFiles ( string localPath, string searchPattern, bool overwrite = false, string remoteDirectoryPath = null ) : void

Upload file(s) to the SFTP server specified in the public properties.

Assumption: the public properties (Host, Username, Password and Hostkey) have been initialized before calling this method.

UploadFiles ( string sftpConnectionString, string localPath, string searchPattern, bool overwrite = false, string remoteDirectoryPath = null ) : void

Upload file(s) to the SFTP server specified in the connection string.

The SFTP connection string is in the form: "username=USERNAME;password=PASSWORD;host=HOSTNAME;hostkey=ssh-dss 1024 9b:3f:14:6a:6f:36:7f:b7:58:f4:e4:89:0d:3f:c2:26".

Private Methods

Method Description
CreateRemoteDirectory ( SftpClient sftp, string fileName, string remoteDirectoryPath ) : string
CreateSftpClient ( this connectionString ) : SftpClient
DoesRemoteFileExist ( this sftp, string path ) : bool
UploadFile ( this sftp, FileInfo file, bool overwrite = false, string remoteDirectoryPath = null ) : void
UploadFile ( this sftp, string fileName, bool overwrite = false, string remoteDirectoryPath = null ) : void

Method Details

UploadFile() public static method

Upload a file to the SFTP server specified in the public properties.
Assumption: the public properties (Host, Username, Password and Hostkey) have been initialized before calling this method.
public static UploadFile ( string fileName, bool overwrite = false, string remoteDirectoryPath = null ) : void
fileName string Name of file to upload.
overwrite bool Overwrite the file on the SFTP server if it already exists ? (default=false)
remoteDirectoryPath string Target path on remote server. (default=null)
return void

UploadFile() public static method

Upload a file to the SFTP server specified in the connection string.
The SFTP connection string is in the form: "username=USERNAME;password=PASSWORD;host=HOSTNAME;hostkey=ssh-dss 1024 9b:3f:14:6a:6f:36:7f:b7:58:f4:e4:89:0d:3f:c2:26".
public static UploadFile ( string sftpConnectionString, string fileName, bool overwrite = false, string remoteDirectoryPath = null ) : void
sftpConnectionString string Connection string for a SFTP server.
fileName string Name of file to upload.
overwrite bool Overwrite the file on the SFTP server if it already exists ? (default=false)
remoteDirectoryPath string Target path on remote server. (default=null)
return void

UploadFiles() public static method

Upload file(s) to the SFTP server specified in the public properties.
Assumption: the public properties (Host, Username, Password and Hostkey) have been initialized before calling this method.
public static UploadFiles ( string localPath, string searchPattern, bool overwrite = false, string remoteDirectoryPath = null ) : void
localPath string Path to upload from.
searchPattern string Wildcard pattern to use to find files (e.g., "*.txt")
overwrite bool Overwrite the file on the SFTP server if it already exists ? (default=false)
remoteDirectoryPath string Target path on remote server. (default=null)
return void

UploadFiles() public static method

Upload file(s) to the SFTP server specified in the connection string.
The SFTP connection string is in the form: "username=USERNAME;password=PASSWORD;host=HOSTNAME;hostkey=ssh-dss 1024 9b:3f:14:6a:6f:36:7f:b7:58:f4:e4:89:0d:3f:c2:26".
public static UploadFiles ( string sftpConnectionString, string localPath, string searchPattern, bool overwrite = false, string remoteDirectoryPath = null ) : void
sftpConnectionString string Connection string for a SFTP server.
localPath string Path to upload from.
searchPattern string Wildcard pattern to use to find files (e.g., "*.txt")
overwrite bool Overwrite the file on the SFTP server if it already exists ? (default=false)
remoteDirectoryPath string Target path on remote server. (default=null)
return void