code: public static void listStatusForLeafDir(FileSystem fs,
        FileStatus pathStatus,
        List<FileStatus> acc) throws IOException {
      if (!pathStatus.isDir())
        return;
      FileStatus[] fileStatusResults = fs.listStatus(pathStatus.getPath());
      if (fileStatusResults == null) {
        throw new IOException("Path does not exist: " + pathStatus.getPath());
      }
  
      boolean leafDir = true;
      for (FileStatus f : fileStatusResults) {
        if (f.isDir()) {
          leafDir = false;
          listStatusForLeafDir(fs, f, acc);
        }
      }
      if (leafDir) {
        acc.add(pathStatus); // Accumulate leaf dir
      }
    }
docs: pass in a directory path, get the list of statuses of leaf directories
  @param fs file system
  @param path path to scan
  @param acc the collection of file status of leaf directories
  @throws IOException if any error occurs