Expand my Community achievements bar.

SOLVED

File deletion from external account SFTP

Avatar

Community Advisor

Hi @Prameya 

 

I was not able to respond in the chat as it did not allow me to respond there.

 

You can use a Sling Servlet or a Scheduler to achieve this use case.


Check link here:

https://commons.apache.org/proper/commons-net/apidocs/org/apache/commons/net/ftp/FTPClient.html

 

FTPClient client = new FTPClient();
client.connect(host, port);
client.login(loginname, password);
client.deleteFile(fileNameOnServer);
client.disconnect();

 

Hope this helps!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Check link here:

https://commons.apache.org/proper/commons-net/apidocs/org/apache/commons/net/ftp/FTPClient.html

 

FTPClient client = new FTPClient();
client.connect(host, port);
client.login(loginname, password);
client.deleteFile(fileNameOnServer);
client.disconnect();

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Check link here:

https://commons.apache.org/proper/commons-net/apidocs/org/apache/commons/net/ftp/FTPClient.html

 

FTPClient client = new FTPClient();
client.connect(host, port);
client.login(loginname, password);
client.deleteFile(fileNameOnServer);
client.disconnect();