Package org.apache.commons.net.ftp

Examples of org.apache.commons.net.ftp.FTPClient.listFiles()


                    FTPClientConfig config = new FTPClientConfig();
                    config.setLenientFutureDates(true);
                    ftp.configure(config );
                }

                for (FTPFile f : ftp.listFiles(remote)) {
                    System.out.println(f.getRawListing());
                    System.out.println(f.toFormattedString());
                }
            }
            else if (mlsd)
View Full Code Here


    }

    public void poll() throws Exception {
        FTPClient ftp = (FTPClient) borrowClient();
        try {
            FTPFile[] files = ftp.listFiles(getWorkingPath());
            for (int i = 0; i < files.length; i++) {
                pollFile(files[i]);
            }
        }
        finally {
View Full Code Here

    private FTPClient actionListDir() throws PageException, IOException {
        required("name",name);
        required("directory",directory);
       
        FTPClient client = getClient();
        FTPFile[] files = client.listFiles(directory);
        if(files==null)files=new FTPFile[0];
       
        String[] cols = new String[]{"attributes","isdirectory","lastmodified","length","mode","name",
                "path","url","type","raw"};
        String[] types = new String[]{"VARCHAR","BOOLEAN","DATE","DOUBLE","VARCHAR","VARCHAR",
View Full Code Here

        try {
            ftp = borrowClient();
            if (logger.isDebugEnabled()) {
                logger.debug("Processing file " + file);
            }
            if (ftp.listFiles(file).length > 0) {
                // Process the file. If processing fails, an exception should be thrown.
                processFile(ftp, file);
                // Processing is successful
                // We should not unlock until the file has been deleted
                unlock = false;
View Full Code Here

                    FTPClientConfig config = new FTPClientConfig();
                    config.setLenientFutureDates(true);
                    ftp.configure(config );
                }

                for (FTPFile f : ftp.listFiles(remote)) {
                    System.out.println(f.getRawListing());
                    System.out.println(f.toFormattedString());
                }
            }
            else if (mlsd)
View Full Code Here

            }
            else if (isFile)
            {
                // Changing the working directory to the parent folder, it should be better if
                // the ftpClient API would provide a way to retrieve the parent folder
                FTPFile[] listFiles = client.listFiles(path);
                String directory = path.replaceAll(listFiles[0].getName(), "");
                client.changeWorkingDirectory(directory);
            }
        }
        return client;
View Full Code Here

        {
            client = connector.createFtpClient(endpoint);
            FTPFile fileToProcess;
            if(connector.isFile(endpoint,client))
            {
                fileToProcess = client.listFiles(endpoint.getEndpointURI().getPath())[0];
            }
            else
            {
                fileToProcess = findFileToProcess(client);
                if (fileToProcess == null)
View Full Code Here

      clienteFtp.enterLocalPassiveMode();
      clienteFtp.setFileType(FTPClient.BINARY_FILE_TYPE);
     
      // Lista el directorio del servidor FTP
      System.out.println("Listando el directorio ra�z del servidor . . ");
      FTPFile[] ficheros = clienteFtp.listFiles();
      for (int i = 0; i < ficheros.length; i++) {
        System.out.println(ficheros[i].getName());
      }
     
      // Fija los ficheros remoto y local
View Full Code Here

    final String name1 = "file1";
    final String name2 = "file2";

    try (final Tx tx = app.tx()) {

      FTPFile[] files = ftp.listFiles();

      assertNotNull(files);
      assertEquals(0, files.length);

      ftp.setFileType(FTP.ASCII_FILE_TYPE);
View Full Code Here

    final String name1 = "file1";
    final String name2 = "file2";

    try (final Tx tx = app.tx()) {

      FTPFile[] files = ftp.listFiles();

      assertNotNull(files);
      assertEquals(0, files.length);

      // Create files by API methods
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.