List of usage examples for org.apache.commons.net.ssh SSHClient newSCPFileTransfer
public SCPFileTransfer newSCPFileTransfer()
From source file:examples.ssh.SCPDownload.java
public static void main(String[] args) throws Exception { SSHClient ssh = new SSHClient(); // ssh.useCompression(); // => significant speedup for large file transfers on fast links ssh.loadKnownHosts();/*from w ww . j ava 2s .com*/ ssh.connect("localhost"); try { ssh.authPublickey(System.getProperty("user.name")); ssh.newSCPFileTransfer().download("well", "/tmp/"); } finally { ssh.disconnect(); } }
From source file:examples.ssh.SCPUpload.java
public static void main(String[] args) throws Exception { SSHClient ssh = new SSHClient(); ssh.loadKnownHosts();//from w w w .j a va 2s .c o m ssh.connect("localhost"); try { ssh.authPublickey(System.getProperty("user.name")); // Compression = significant speedup for large file transfers on fast links // present here to demo algorithm renegotiation - could have just put this before connect() ssh.useCompression(); ssh.newSCPFileTransfer().upload("/Users/shikhar/well", "/tmp/"); } finally { ssh.disconnect(); } }