code: public void renameFile(String oldpath, String newpath)
  			throws SftpStatusException, SshException {
  
  		if (version < 2) {
  			throw new SftpStatusException(
  					SftpStatusException.SSH_FX_OP_UNSUPPORTED,
  					"Renaming files is not supported by the server SFTP version "
  							+ String.valueOf(version));
  		}
  		try {
  			UnsignedInteger32 requestId = nextRequestId();
  			Packet msg = createPacket();
  			msg.write(SSH_FXP_RENAME);
  			msg.writeInt(requestId.longValue());
  			msg.writeString(oldpath, CHARSET_ENCODING);
  			msg.writeString(newpath, CHARSET_ENCODING);
  
  			sendMessage(msg);
  
  			getOKRequestStatus(requestId);
  		} catch (SshIOException ex) {
  			throw ex.getRealException();
  		} catch (IOException ex) {
  			throw new SshException(ex);
  		}
  		EventServiceImplementation
  				.getInstance()
  				.fireEvent(
  						(new Event(this,
  								J2SSHEventCodes.EVENT_SFTP_FILE_RENAMED, true))
  								.addAttribute(
  										J2SSHEventCodes.ATTRIBUTE_FILE_NAME,
  										oldpath)
  								.addAttribute(
  										J2SSHEventCodes.ATTRIBUTE_FILE_NEW_NAME,
  										newpath));
  	}
docs: Rename an existing file.
  
  @param oldpath
  @param newpath
  @throws SftpStatusException
  , SshException