public boolean delete(Path path, boolean recursive) throws IOException {
   Path absolutePath = makeAbsolute(path);
   INode inode = store.retrieveINode(absolutePath);
   if (inode == null) {
     return false;
   }
   if (inode.isFile()) {
     store.deleteINode(absolutePath);
     for (Block block : inode.getBlocks()) {
       store.deleteBlock(block);
     }
   } else {
     FileStatus[] contents = listStatus(absolutePath);
     if (contents == null) {
       return false;
     }
     if ((contents.length != 0) && (!recursive)) {
       throw new IOException("Directory " + path.toString() + " is not empty.");
     }
     for (FileStatus p : contents) {
       if (!delete(p.getPath(), recursive)) {
         return false;
       }
     }
     store.deleteINode(absolutePath);
   }
   return true;
 }
 private boolean renameRecursive(Path src, Path dst) throws IOException {
   INode srcINode = store.retrieveINode(src);
   store.storeINode(dst, srcINode);
   store.deleteINode(src);
   if (srcINode.isDirectory()) {
     for (Path oldSrc : store.listDeepSubPaths(src)) {
       INode inode = store.retrieveINode(oldSrc);
       if (inode == null) {
         return false;
       }
       String oldSrcPath = oldSrc.toUri().getPath();
       String srcPath = src.toUri().getPath();
       String dstPath = dst.toUri().getPath();
       Path newDst = new Path(oldSrcPath.replaceFirst(srcPath, dstPath));
       store.storeINode(newDst, inode);
       store.deleteINode(oldSrc);
     }
   }
   return true;
 }