FTP: Comment télécharger les fichiers

Author:

 fichier,ftp, Connexion, java, apache, connexion, télécharger, ftp
{filelink=9024}


import org.apache.commons.net.ftp.FTPClient;
import java.io.IOException;
import java.io.FileOutputStream;

public class FTPDownload
{

  public static void main(String[] args) throws Exception
  {
    FTPClient client = new FTPClient();
    client.connect("ftp.exemple.com");

    boolean login = client.login("admin", "******");

    // Quitter le programme si la connexion a échouée
    if (!login)
    {
      System.out.println("La connexion à échouée");

      // Quitter le programme
       System.exit(0);
    } 

     // Télécharger le fichier index.php
     String fichier = "index.php";
    FileOutputStream stream_out = new FileOutputStream(fichier);
    client.retrieveFile("/" + fichier, stream_out);

    // Fermer le flux et la connexion FTP
    stream_out.close();
    client.disconnect();
  }
}

A Voir sur le même Sujet:

  • pdf java, tableau dynamique avec la class Vector et importation de fichier csv
  • comment techarge fichier ftp
  • ftp downloader un fichier
  • java telecharger fichier ftp
  • comment on tellcharge les dossier f t p par unelangue arabe
  • index ftp cours java
  • comment télécharger des DOCUMENTS en java
  • liste chaine arab ftp
  • créer un programme de téléchargement en java swing
  • commons net ftp retrievefile accented

Leave a Reply

Your email address will not be published. Required fields are marked *