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

14
LINES

< > BotCompany Repo | #1011874 // scpDownload

JavaX fragment (include)

import net.schmizz.sshj.xfer.InMemorySourceFile;
import net.schmizz.sshj.xfer.scp.SCPFileTransfer;

static void scpDownload(S user, S host, fS remotePath, File localDir) ctex {
  final SSHClient client = sshLogin(user, host);
  try {
    SCPFileTransfer fileTransfer = client.newSCPFileTransfer();
    File f = new File(localDir, afterLastSlash(remotePath));
    print("Downloading " + user + "@" + host + ":" + remotePath + " to " + f2s(f));
    fileTransfer.download(remotePath, f2s(mkdirsForFile(f)));
  } finally {
    sshDisconnect(client);
  }
}

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: 379 / 422
Version history: 3 change(s)
Referenced in: [show references]