/** * Carry out the transfer. * @throws IOException on i/o errors * @throws JSchException on errors detected by scp */ @Override public void execute() throws IOException, JSchException { if (directoryList != null) { doMultipleTransfer(); } if (localFile != null) { doSingleTransfer(); } log("done.\n"); }
final boolean trackProgress = getVerbose() && filesize > HUNDRED_KILOBYTES; monitor = getProgressMonitor(); if (this.getVerbose()) { log("Sending: " + localFile.getName() + " : " + filesize); transferredFileRemotePath = remotePath; if (this.getVerbose()) { log("Setting file mode '" + Integer.toOctalString(getFileMode()) + "' on remote path " + transferredFileRemotePath); channel.chmod(getFileMode(), transferredFileRemotePath); if (getPreserveLastModified()) { if (this.getVerbose()) { log("Setting last modified time on remote path " + transferredFileRemotePath + " to " + lastModifiedTime); if (this.getVerbose()) { final long endTime = System.currentTimeMillis(); logStats(startTime, endTime, (int) totalLength);
private void doMultipleTransfer() throws IOException, JSchException { final ChannelSftp channel = openSftpChannel(); try { channel.connect(); channel.chmod(getDirMode(), remotePath); } else { throw new JSchException("failed to access remote dir '" if (getVerbose()) { log("Sending directory " + current); sendDirectory(channel, current); } catch (final SftpException e) { String msg = "Error sending directory";
private void sendDirectoryToRemote(final ChannelSftp channel, final Directory directory) throws IOException, SftpException { final String dir = directory.getDirectory().getName(); try { channel.stat(dir); } catch (final SftpException e) { // dir does not exist. if (e.id == ChannelSftp.SSH_FX_NO_SUCH_FILE) { channel.mkdir(dir); channel.chmod(getDirMode(), dir); } } channel.cd(dir); sendDirectory(channel, directory); channel.cd(".."); }
list, file, preserveLastModified); } else { message = new ScpToMessageBySftp(getVerbose(), session, list, file, preserveLastModified);
} else { message = new ScpToMessageBySftp(getVerbose(), session, getProject().resolveFile(fromPath), file, preserveLastModified);