Package org.apache.commons.net.ftp

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


        } finally {
            if (out != null) {
                try {
                    out.close();
                    client.completePendingCommand();
                    if (name != null && !name.equals(uploadName) && !client.rename(uploadName, name)) {
                        throw new IOException("File " + uploadName + " could not be renamed to " + name);
                    }
                } catch (IOException e) {
                    logger.error("Caught exception while closing stream on error: " + e, e);
                }
View Full Code Here


        } finally {
            if (out != null) {
                try {
                    out.close();
                    client.completePendingCommand();
                    if (name != null && !name.equals(uploadName) && !client.rename(uploadName, name)) {
                        throw new IOException("File " + uploadName + " could not be renamed to " + name);
                    }
                } catch (IOException e) {
                    logger.error("Caught exception while closing stream on error: " + e, e);
                }
View Full Code Here

    private FTPClient actionRename() throws PageException, IOException {
        required("existing",existing);
        required("new",_new);
       
        FTPClient client = getClient();
    client.rename(existing,_new);
        writeCfftp(client);
       
        return client;
    }
View Full Code Here

      fail("Unexpected exception: " + ex.getMessage());
    }

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

      ftp.rename(name1, name2);

      tx.success();

    } catch (IOException | FrameworkException ex) {
      ex.printStackTrace();
View Full Code Here

    }

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

       // Move file to dir
      ftp.rename("/" + name1, "/" + name2 + "/" + name1);
      tx.success();

    } catch (Exception ex) {
      ex.printStackTrace();
      fail("Unexpected exception: " + ex.getMessage());
View Full Code Here

    }

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

      // Move file to dir
      ftp.rename("/" + name1, "/" + name2 + "/" + name1);
      tx.success();

    } catch (Exception ex) {
      ex.printStackTrace();
      fail("Unexpected exception: " + ex.getMessage());
View Full Code Here

      assertNotNull(fileNames);
      assertEquals(1, fileNames.length);
      assertEquals(name1, fileNames[0]);

      // Move file back to /
      ftp.rename("/" + name2 + "/" + name1, "/" + name1);
      tx.success();

    } catch (Exception ex) {
      ex.printStackTrace();
      fail("Unexpected exception: " + ex.getMessage());
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.