Package org.apache.commons.net.ftp

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


        assertTrue(client1.makeDirectory("foo2"));
        assertTrue(client1.removeDirectory("foo2"));
        assertTrue(client1.storeFile(TEST_FILENAME, new ByteArrayInputStream(TESTDATA)));
        assertTrue(client1.storeFile(TEST_FILENAME, new ByteArrayInputStream(TESTDATA)));
        assertTrue(client1.retrieveFile(TEST_FILENAME, new ByteArrayOutputStream()));
        assertTrue(client1.deleteFile(TEST_FILENAME));
       
        assertTrue(client1.logout());
        client1.disconnect();

        FTPClient client2 = new FTPClient();
View Full Code Here


                    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

                processFile(ftp, file);
                // Processing is successful
                // We should not unlock until the file has been deleted
                unlock = false;
                if (isDeleteFile()) {
                    if (!ftp.deleteFile(file)) {
                        throw new IOException("Could not delete file " + file);
                    }
                    unlock = true;
                }
            } else {
View Full Code Here

        }
        FTPClient client = null;
        try {
            client = (FTPClient) borrowClient();
            processFile(client, file);
            if (!client.deleteFile(getWorkingPath() + file.getName())) {
                throw new IOException("Could not delete file " + file);
            }
        }
        catch (Exception e) {
            log.error("Failed to process file: " + file + ". Reason: " + e, e);
View Full Code Here

        LOG.info("*****assert files done******");
        new File(prefix + "2.pdf").delete();
        FTPClient client = new FTPClient();
        client.connect(readConfig.getUrl());
        client.login(readConfig.getLogin(), readConfig.getPass());
        client.deleteFile("~/backup/1/1.pdf");
        client.disconnect();
        LOG.info("*****clean directories done******\n");
    }

    @Test
View Full Code Here

        FTPClient client = getClient();
        if (isDirectory()) {
            for (IPath i : ls()) {
                res |= !i.delete();
            }
            res |= client.deleteFile(getPath());
            log.debug("ftp delete file " + getPath() + " reply code: " + client.getReplyCode() + ", reply string: " + client.getReplyString());
            client.disconnect();
            return !res;
        } else {
            try {
View Full Code Here

            log.debug("ftp delete file " + getPath() + " reply code: " + client.getReplyCode() + ", reply string: " + client.getReplyString());
            client.disconnect();
            return !res;
        } else {
            try {
                return client.deleteFile(getPath());
            } finally {
                log.debug("ftp delete file " + getPath() + " reply code: " + client.getReplyCode() + ", reply string: " + client.getReplyString());
                client.disconnect();
            }
        }
View Full Code Here

            else {
                out = client.storeFileStream(name);
                if (out == null) {
                    // lets try overwrite the previous file?
                    if (overwrite) {
                        client.deleteFile(name);
                    }
                    out = client.storeFileStream(name);
                }
            }
            if (out == null) {
View Full Code Here

        }
        FTPClient client = null;
        try {
            client = (FTPClient) borrowClient();
            processFile(client, file);
            if (!client.deleteFile(getWorkingPath() + file.getName())) {
                throw new IOException("Could not delete file " + file);
            }
        }
        catch (Exception e) {
            log.error("Failed to process file: " + file + ". Reason: " + e, e);
View Full Code Here

        assertTrue(client1.makeDirectory("foo2"));
        assertTrue(client1.removeDirectory("foo2"));
        assertTrue(client1.storeFile(TEST_FILENAME, new ByteArrayInputStream(TESTDATA)));
        assertTrue(client1.storeFile(TEST_FILENAME, new ByteArrayInputStream(TESTDATA)));
        assertTrue(client1.retrieveFile(TEST_FILENAME, new ByteArrayOutputStream()));
        assertTrue(client1.deleteFile(TEST_FILENAME));
       
        assertTrue(client1.logout());
        client1.disconnect();

        FTPClient client2 = new FTPClient();
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.