public static long count(final Path dir,
                             final Predicate<Path> pathExclusionFilter) {
        final AtomicLong count = new AtomicLong();
        try (final DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {
            stream
                    .forEach(file -> {
                        if (pathExclusionFilter != null && !pathExclusionFilter.test(file)) {
                            try {
                                count.incrementAndGet();
                            } catch (final RuntimeException e) {
                                LOGGER.debug(e.getMessage(), e);
                            }
                        }
                    });
        } catch (final IOException e) {
            LOGGER.debug(e.getMessage(), e);
        }
        return count.get();
    }
@return True if path contains no files or directories.
@throws IOException if it is unable to list the contents of path
stroom-util/src/main/java/stroom/util/io/FileUtil.java