code: public void rename(String oldpath, String newpath)
  			throws SftpStatusException, SshException {
  		String from = resolveRemotePath(oldpath);
  		String to = resolveRemotePath(newpath);
  
  		SftpFileAttributes attrs = null;
  
  		try {
  			attrs = sftp.getAttributes(to);
  
  		} catch (SftpStatusException ex) {
  			sftp.renameFile(from, to);
  			return;
  		}
  
  		if (attrs != null && attrs.isDirectory()) {
  			sftp.renameFile(from, to);
  		} else {
  			throw new SftpStatusException(
  					SftpStatusException.SSH_FX_FILE_ALREADY_EXISTS, newpath
  							+ " already exists on the remote filesystem");
  		}
  
  	}
docs: <p>
  Rename a file on the remote computer.
  </p>
  
  @param oldpath
  the old path
  @param newpath
  the new path
  
  @throws SftpStatusException
  @throws SshException