* Carry out the transfer.
* @throws IOException on i/o errors
* @throws JSchException on errors detected by scp
*/
public void execute() throws IOException, JSchException {
ChannelSftp channel = openSftpChannel();
try {
channel.connect();
try {
SftpATTRS attrs = channel.stat(remoteFile);
if (attrs.isDir() && !remoteFile.endsWith("/")) {
remoteFile = remoteFile + "/";
}
} catch (SftpException ee) {
// Ignored
}
getDir(channel, remoteFile, localFile);
} catch (SftpException e) {
throw new JSchException(e.toString());
} finally {
if (channel != null) {
channel.disconnect();
}
}
log("done\n");
}