Class Scp
Provides functionality to communicate with a server via the Secure Copy Protocol (SCP).
public class Scp : SshTransferProtocolBase, ITransferProtocol
- Inheritance
-
Scp
- Implements
- Inherited Members
- Extension Methods
Examples
Scp scp = null;
try
{
scp = new Scp("192.168.2.201", "user", "pw");
scp.Timeout = 5 * 1000;
scp.Connect();
if (scp.Connected)
{
scp.Get("path/to/remote/file", "path/to/local/file");
}
}
catch(Exception e)
{
// Handle exception.
}
finally
{
if(scp != null)
{
scp.Close();
}
}
Scp scp = null;
try
{
scp = new Scp(host, userName);
scp.AddIdentityFile(identityFile);
scp.Timeout = 5000;
scp.Connect();
if (scp.Connected)
{
scp.Get(fileToDownLoad, downloadLocation);
}
}
catch (Exception e)
{
// Handle exception.
}
finally
{
if(scp != null)
{
scp.Close();
}
}
Constructors
- Scp(string, string)
Initializes a new instance of the Scp class using the host and username.
- Scp(string, string, string)
Initializes a new instance of the Scp class using the host, username and password.
Properties
- ChannelType
Gets the channel type.
- PreserveFileAttributes
Gets or sets a value indicating whether to preserve file attributes.
- Recursive
Gets or sets a value indicating whether the copy is recursive.
- Verbos
Gets or sets a value indicating whether verbose output is enabled.
Methods
- Cancel()
Cancels the operation.
- From(string, string)
Copies the specified file from the server to the specified folder.
- From(string, string, bool)
Copies the specified file from the server to the specified folder.
- Get(string, string)
Copies the specified file from the server to the specified folder.
- Mkdir(string)
Creates the specified directory.
- Put(string, string)
Copies the specified file from the server.
- To(string, string)
Copies the specified file to the sever.
- To(string, string, bool)
Copies the specified file to the sever.