Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public FtpsClientObject()
public abstract boolean connect(FtpsOptions options);
public abstract boolean put(String localPath, String remoteDir);
public abstract boolean get(String remoteFilePath, String localDir);
public abstract boolean rm(String remoteFilePath);
public abstract void disconnect();
public abstract String getWorkingDirectory();
}
32 changes: 32 additions & 0 deletions GeneXusFtps/src/main/java/com/genexus/ftps/FtpsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,38 @@ public boolean get(String remoteFilePath, String localDir) {
return true;

}

public boolean rm(String remoteFilePath) {
if (this.client == null || !this.client.isConnected()) {
this.error.setError("FS019", "The connection is invalid, reconect");
return false;
}
boolean dirchange = true;
try {
if (!isSameDir(getDirectory(remoteFilePath), this.client.printWorkingDirectory())) {
dirchange = this.client.changeWorkingDirectory(getDirectory(remoteFilePath));
this.pwd = getDirectory(remoteFilePath);
}

} catch (IOException e2) {
this.error.setError("FS020", "Error changing directory " + e2.getMessage());
return false;
}
if (!dirchange) {
this.error.setError("FS021",
"Reply code: " + this.client.getReplyCode() + " Reply String: " + this.client.getReplyString());
return false;
}
boolean deleted = false;
try {
deleted = this.client.deleteFile(remoteFilePath);
} catch (Exception e) {
this.error.setError("FS022", "Error retrieving file " + e.getMessage());
deleted = false;
}
return deleted;

}

public void disconnect() {
if (this.client != null && this.client.isConnected()) {
Expand Down