code: public boolean moveAndDeleteRelativePath(String volume, String pathName)
        throws IOException {
      
      volume = normalizePath(volume);
      
      // Move the file right now, so that it can be deleted later
      String newPathName = 
          format.format(new Date()) + "_" + uniqueId.getAndIncrement();
      newPathName = TOBEDELETED + Path.SEPARATOR_CHAR + newPathName;
      
      Path source = new Path(volume, pathName);
      Path target = new Path(volume, newPathName);
      try {
        if (!localFileSystem.rename(source, target)) {
          // If the source does not exists, return false.
          // This is necessary because rename can return false if the source  
          // does not exists.
          if (!localFileSystem.exists(source)) {
            return false;
          }
          // Try to recreate the parent directory just in case it gets deleted.
          if (!localFileSystem.mkdirs(new Path(volume, TOBEDELETED))) {
            throw new IOException("Cannot create " + TOBEDELETED + " under "
                + volume);
          }
          // Try rename again. If it fails, return false.
          if (!localFileSystem.rename(source, target)) {
            throw new IOException("Cannot rename " + source + " to "
                + target);
          }
        }
      } catch (FileNotFoundException e) {
        // Return false in case that the file is not found.  
        return false;
      }
  
      DeleteTask task = new DeleteTask(volume, pathName, newPathName);
      execute(volume, task);
      return true;
    }
docs: Move the path name on one volume to a temporary location and then
  delete them.
  
  This functions returns when the moves are done, but not necessarily all
  deletions are done. This is usually good enough because applications
  won't see the path name under the old name anyway after the move.
  
  @param volume       The disk volume
  @param pathName     The path name relative to volume root.
  @throws IOException If the move failed
  @return   false     if the file is not found