sshj icon indicating copy to clipboard operation
sshj copied to clipboard

downloading directory issue

Open hsoehalim opened this issue 4 years ago • 1 comments

Hi There,

I'm using v0.31.0 and i ran into a problem when i try to download a directory from remote to local with this structure: "root/foo/foo/foo/"

The client doesn't preserve the directory structure. I'm getting: "local/root/foo/" instead of "local/root/foo/foo/foo/".

snippet of my code: try (SSHClient ssh = new SSHClient ()) { createDirectories (local.getParent ()); ssh.addHostKeyVerifier (new PromiscuousVerifier ()); ssh.connect (server); ssh.authPassword (serverUser, serverPass); ssh.newSCPFileTransfer ().download (target.toString (), local.toString ()); } catch (Exception e) { throw new RuntimeException (e); }

where:

  • local=~/local
  • target=~/root

hsoehalim avatar Apr 16 '21 07:04 hsoehalim

I'm planning to write some code to do exactly the same thing, monitor a folder for files matching *.xml and when it finds one or more files it will download them one at a time and then delete the original. I was wondering if you have made any progress ?

C4J avatar Jun 28 '21 20:06 C4J