I am attempting to upload a file to an SFTP site, but the entire directory structure is being recreated on the SFTP site instead of just uploading the file at the root. I am calling sendSftp (see below).
public void sendSftp(String filename, IPropertyHelper ph) {
def local = VFS.getManager().toFileObject(new File("${filename}"))
def remote = VFS.getManager().resolveFile(buildSftpPath(filename, ph), new FileSystemOptions());
remote.copyFrom(local, Selectors.SELECT_SELF)
}
private String buildSftpPath(filename, IPropertyHelper ph) {
return "sftp://${ph.properties.sftp_Login}:${ph.properties.sftp_Password}@${ph.properties.sftp_Hostname}/${filename}"
}
Any help in how to send just the file and place it at the root of the SFTP site would be great, thanks!
What is
filename
? I suspectbuildSftpPath(filename, ph)
is building the full directory structure... TrybuildSftpPath(new File( filename ).name, ph)