Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

14
LINES

< > BotCompany Repo | #1011874 // scpDownload

JavaX fragment (include)

1  
import net.schmizz.sshj.xfer.InMemorySourceFile;
2  
import net.schmizz.sshj.xfer.scp.SCPFileTransfer;
3  
4  
static void scpDownload(S user, S host, fS remotePath, File localDir) ctex {
5  
  final SSHClient client = sshLogin(user, host);
6  
  try {
7  
    SCPFileTransfer fileTransfer = client.newSCPFileTransfer();
8  
    File f = new File(localDir, afterLastSlash(remotePath));
9  
    print("Downloading " + user + "@" + host + ":" + remotePath + " to " + f2s(f));
10  
    fileTransfer.download(remotePath, f2s(mkdirsForFile(f)));
11  
  } finally {
12  
    sshDisconnect(client);
13  
  }
14  
}

Author comment

Began life as a copy of #1009981

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1011874
Snippet name: scpDownload
Eternal ID of this version: #1011874/4
Text MD5: b514e35d4622168f8c57c1abb636d2e8
Author: stefan
Category: javax / networking
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-27 22:30:17
Source code size: 566 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 314 / 356
Version history: 3 change(s)
Referenced in: [show references]