how to delete file from ftp server using java?

后端 未结 4 730
无人及你
无人及你 2021-02-19 04:07

How can I delete a file from an ftp server using a java program? I am successfully able to upload files on the ftp using the following code:

public static void m         


        
4条回答
  •  渐次进展
    2021-02-19 05:00

    You can use Apache FTPClient to do this and all other commands on FTP. Use it something like this:

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

提交回复
热议问题