Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Java: How to delete file from FTP server

Java: How to delete file from FTP server
{filelink=9025}

import org.apache.commons.net.ftp.FTPClient;
import java.io.IOException;
public class FTPDelete
{
  public static void main(String[] args)throws Exception
  {
    FTPClient client_FTP = new FTPClient();
    client_FTP.connect("ftp.exemple.com");
    boolean etat= client_FTP.login("admin", "******");
     if(!etat)
     	System.exit(1);
    // delete the file 'index.php'
    boolean result = client_FTP.deleteFile("index.php");
    if (result)
    {
      System.out.println("The file has been deleted");
    }else
    {
     System.out.println("Icannot delete this file");
    }
    client_FTP.logout();
    client_FTP.disconnect();
  }
}

Users who found this page were searching for:

  • import smtplib import zipfile import tempfile
  • network programming ftp client java ftp server java
  • a program in java to display a dictionary using sockets and threads
  • delete file from server in java
  • python getfile *.txt
  • program for ftp which create, transfer and delete file in java
  • java socket programming ftp server with gui
  • python with iterare binary

No comments yet.

Leave a Comment