public static int countChildren(Path p) throws IOException {
        int i = 0;
        try (DirectoryStream<Path> ds = Files.newDirectoryStream(p)) {
            for (Path d : ds) {
                i++;
            }
        }
        return i;
    }
Counts immediate children only, does not work recursively

@param p
@return
@throws IOException
tika-batch/src/test/java/org/apache/tika/batch/fs/FSBatchTestBase.java