private static void deleteZnodeRecursively(String connectionString, String znode) throws IOException, InterruptedException, KeeperException {
    ZooKeeper client = ZkConnection.open(connectionString, SESSION_TIMEOUT_MILLIS, CONNECTION_TIMEOUT_MILLIS);
    try {
      ZkPathPattern paths = ZkPathPattern.fromString(znode);
      for (String path : paths.findMatchingPaths(client, "/")) {
        System.out.println("Recursively deleting znodes with matching path " + path);
        deleteZnodeRecursively(client, path);
      }
    } catch (KeeperException.NoNodeException e) {
      System.out.println("Could not delete " + znode + ". Reason: " + e.getMessage());
    } finally {
      client.close();
    }
  }
I'm a command line utility that provides functionality that the official zookeeper-client does not support.
E.g. I can set ACLs recursively on a znode.
Also I can remove znode recursively.
ambari-agent/src/main/java/org/apache/ambari/tools/zk/ZkMigrator.java