public static long countNested(final Path dir) {
        final AtomicLong count = new AtomicLong();

        try {
            Files.walkFileTree(dir, new SimpleFileVisitor<>() {
                @Override
                public FileVisitResult preVisitDirectory(final Path dir, final BasicFileAttributes attrs)
                        throws IOException {
                    count.incrementAndGet();
                    return super.preVisitDirectory(dir, attrs);
                }

                @Override
                public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException {
                    count.incrementAndGet();
                    return super.visitFile(file, attrs);
                }
            });
        } catch (final IOException e) {
            // Ignore.
        }

        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