Example usage for org.apache.commons.net.ftp FTPCmd RNFR

List of usage examples for org.apache.commons.net.ftp FTPCmd RNFR

Introduction

In this page you can find the example usage for org.apache.commons.net.ftp FTPCmd RNFR.

Prototype

FTPCmd RNFR

To view the source code for org.apache.commons.net.ftp FTPCmd RNFR.

Click Source Link

Usage

From source file:com.adaptris.ftp.ApacheFtpClientImpl.java

/**
 * rename a file on the server//from  w ww.  ja  va2  s .c o m
 * 
 * @param from file to be renamed
 * @param to new name for file
 */
@Override
public void rename(String from, String to) throws IOException {
    try {
        acquireLock();
        log("{} {}", FTPCmd.RNFR, from);
        log("{} {}", FTPCmd.RNTO, to);
        handleReturnValue(ftpClient().rename(from, to));
    } finally {
        logReply(ftpClient().getReplyStrings());
        releaseLock();
    }
}

From source file:com.atomicleopard.thundr.ftp.commons.FTP.java

/***
 * A convenience method to send the FTP RNFR command to the server,
 * receive the reply, and return the reply code.
 * <p>/* w  w  w .  j  a  v  a2 s  .c  o  m*/
 * @param pathname The pathname to rename from.
 * @return The reply code received from the server.
 * @exception FTPConnectionClosedException
 *      If the FTP server prematurely closes the connection as a result
 *      of the client being idle or some other reason causing the server
 *      to send FTP reply code 421.  This exception may be caught either
 *      as an IOException or independently as itself.
 * @exception IOException  If an I/O error occurs while either sending the
 *      command or receiving the server reply.
 ***/
public int rnfr(String pathname) throws IOException {
    return sendCommand(FTPCmd.RNFR, pathname);
}