@Override
protected void copyFrom(OverthereFile source) {
logger.debug("Copying file or directory {} to {}", source, this);
SCPUploadClient uploadClient = connection.getSshClient().newSCPFileTransfer().newSCPUploadClient();
try {
if (source.isDirectory() && this.exists()) {
for (OverthereFile sourceFile : source.listFiles()) {
uploadClient.copy(new OverthereFileLocalSourceFile(sourceFile), getPath());
}
} else {
uploadClient.copy(new OverthereFileLocalSourceFile(source), getPath());
}
} catch (IOException e) {
throw new RuntimeIOException("Cannot copy " + source + " to " + this + ": " + e.toString(), e);
}
}