Package org.apache.commons.net.ftp

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


            }
        }

        System.err.println("System: " + client.getSystemName());

        FTPFile[] files = client.listFiles();
        for (int i = 0; i < files.length; i++)
        {
            FTPFile file = files[i];
            if (file == null)
            {
View Full Code Here


        {
            updateLastAccessed();
          FTPClient client = getFtpClient();
          String dir = client.printWorkingDirectory();
          client.changeWorkingDirectory(relPath);
          FTPFile[] list = client.listFiles(key,null);
          client.changeWorkingDirectory(dir);
            return list;
        }
        catch (IOException e)
        {
View Full Code Here

        {
            disconnect();
          FTPClient client = getFtpClient();
          String dir = client.printWorkingDirectory();
          client.changeWorkingDirectory(relPath);
          FTPFile[] list = client.listFiles(key,null);
          client.changeWorkingDirectory(dir);
            return list;
        }
        finally
        {
View Full Code Here

            }
        }

        System.err.println("System: " + client.getSystemType());

        FTPFile[] files = client.listFiles();
        for (int i = 0; i < files.length; i++)
        {
            FTPFile file = files[i];
            if (file == null)
            {
View Full Code Here

                    out = client.storeUniqueFileStream(uniqueFileName);
                } else {
                    out = client.storeUniqueFileStream();
                }
            } else {
                if (client.listFiles(name).length > 0) {
                    if (overwrite) {
                        client.deleteFile(name);
                    } else {
                        throw new IOException("Can not send " + name
                                + " : file already exists and overwrite has not been enabled");
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

    }

    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

            }
        }

        System.err.println("System: " + client.getSystemName());

        FTPFile[] files = client.listFiles();
        for (int i = 0; i < files.length; i++)
        {
            FTPFile file = files[i];
            if (file == null)
            {
View Full Code Here

            filename = getPath().substring(getPath().lastIndexOf('/') + 1);
            log.debug("FTP WRITE: new filename = '" + filename + "'");
        }
        log.debug("rescheck if file exist");
        int size = 0;
        FTPFile[] files = client.listFiles();
        for (FTPFile i : files) {
            if (i.getName().equals(filename)) {
                log.debug("File " + i.getName() + " exist, appending");
                if (i.getSize() > Integer.MAX_VALUE) {
                    log.error("Sorry, we not support files bigger than " + Integer.MAX_VALUE + " bytes");
View Full Code Here

                    return false;
                }
                log.trace("exist responce code : " + client.getReplyCode() + ", reply: " + client.getReplyString());
               
            }
            FTPFile files[] = client.listFiles();
            for (FTPFile f : files) {
                if (f != null) {
                    find |= pathes[pathes.length - 1].equals(f.getName());
                } else {
                    log.warn("exist: listfiles() return null");
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.