File deletion from external account SFTP | Community
Skip to main content
Asutosh_Jena_
New Participant
Nov 19, 2021 10:07 AM UTC
Solved

File deletion from external account SFTP

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!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Asutosh_Jena_
Asutosh_Jena_Accepted solution
New Participant
Nov 19, 2021 10:08 AM UTC

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();

1 reply

Asutosh_Jena_
Asutosh_Jena_AuthorAccepted solution
New Participant
Nov 19, 2021 10:08 AM UTC

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();

Translate