sshj
sshj copied to clipboard
downloading directory issue
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
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 ?