private void sendDirectoryToRemote(final Directory directory, final InputStream in, final OutputStream out) throws IOException { String command = "D0"; command += Integer.toOctalString(getDirMode()); command += " 0 "; command += directory.getDirectory().getName(); command += "\n"; out.write(command.getBytes()); out.flush(); waitForAck(in); sendDirectory(directory, in, out); out.write("E\n".getBytes()); out.flush(); waitForAck(in); }
out.flush(); waitForAck(in); out.flush(); waitForAck(in); waitForAck(in); } finally { if (this.getVerbose()) {
private void doSingleTransfer() throws IOException, JSchException { StringBuilder sb = new StringBuilder("scp -t "); if (getPreserveLastModified()) { sb.append("-p "); } if (getCompressed()) { sb.append("-C "); } sb.append(remotePath); final String cmd = sb.toString(); final Channel channel = openExecChannel(cmd); try { final OutputStream out = channel.getOutputStream(); final InputStream in = channel.getInputStream(); channel.connect(); waitForAck(in); sendFileToRemote(localFile, in, out); } finally { if (channel != null) { channel.disconnect(); } } }
private void doMultipleTransfer() throws IOException, JSchException { StringBuilder sb = new StringBuilder("scp -r -d -t "); if (getPreserveLastModified()) { sb.append("-p "); } if (getCompressed()) { sb.append("-C "); } sb.append(remotePath); final Channel channel = openExecChannel(sb.toString()); try { final OutputStream out = channel.getOutputStream(); final InputStream in = channel.getInputStream(); channel.connect(); waitForAck(in); for (Directory current : directoryList) { sendDirectory(current, in, out); } } finally { if (channel != null) { channel.disconnect(); } } }