code: public static void actionRename(PageContext pc, Resource directory, String strNewdirectory, String serverPassword, boolean createPath, Object acl, String storage)
  	    throws PageException {
  	// check directory
  	SecurityManager securityManager = pc.getConfig().getSecurityManager();
  	securityManager.checkFileLocation(pc.getConfig(), directory, serverPassword);
  
  	if (!directory.exists()) throw new ApplicationException("the directory [" + directory.toString() + "] doesn't exist");
  	if (!directory.isDirectory()) throw new ApplicationException("the file [" + directory.toString() + "] exists, but it isn't a directory");
  	if (!directory.canRead()) throw new ApplicationException("no access to read directory [" + directory.toString() + "]");
  
  	if (strNewdirectory == null) throw new ApplicationException("the attribute [newDirectory] is not defined");
  
  	// real to source
  	Resource newdirectory = toDestination(pc, strNewdirectory, directory);
  
  	securityManager.checkFileLocation(pc.getConfig(), newdirectory, serverPassword);
  	if (newdirectory.exists()) throw new ApplicationException("new directory [" + newdirectory.toString() + "] already exists");
  	if (createPath) {
  	    newdirectory.getParentResource().mkdirs();
  
  	}
  	try {
  	    directory.moveTo(newdirectory);
  	}
  	catch (Throwable t) {
  	    ExceptionUtil.rethrowIfNecessary(t);
  	    throw Caster.toPageException(t);
  	}
  
  	// set S3 stuff
  	setS3Attrs(pc, directory, acl, storage);
  
      }
docs: rename a directory to a new Name
  
  @throws PageException