code: public boolean delete(Path path, boolean recursive) throws IOException {
        Path absolute = makeAbsolute(path);
        String srep = absolute.toUri().getPath();
        if (kfsImpl.isFile(srep))
          return kfsImpl.remove(srep) == 0;
  
        FileStatus[] dirEntries = listStatus(absolute);
        if ((!recursive) && (dirEntries != null) && 
              (dirEntries.length != 0)) {
          throw new IOException("Directory " + path.toString() + 
          " is not empty.");
        }
        if (dirEntries != null) {
          for (int i = 0; i < dirEntries.length; i++) {
            delete(new Path(absolute, dirEntries[i].getPath()), recursive);
          }
        }
        return kfsImpl.rmdir(srep) == 0;
      }
docs: recursively delete the directory and its contents