code: public static void deleteRecursively(ZooKeeperIface zk, String path)
        throws IOException {
      try {
        List<String> children = zk.getChildren(path, false);
        for (String child : children) {
          deleteRecursively(zk, joinPath(path, child));
        }
        zk.delete(path, -1);
      } catch (KeeperException e) {
        keeperException("Unrecoverable ZooKeeper error deleting " + path, e);
      } catch (InterruptedException e) {
        interruptedException("Interrupted deleting " + path, e);
      }
    }
docs: Recursively deletes a ZNode (i.e., delete all the ZNode's children and
  then deletes the ZNode itself). Equivalent to 'rmr' command in
  ZooKeeper CLI.
  
  @param zk ZooKeeper instance
  @param path Path to delete
  @throws IOException If there is an error recursively deleting a ZNode