code: @Nonnegative
      public static int count(@Nonnull final Path dir) throws IOException {
          try (final DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {
              return Iterables.size(stream);
          } catch (DirectoryIteratorException ex) {
              // I/O error encounted during the iteration, the cause is an IOException
              throw ex.getCause();
          }
      }
docs: Count the number of entries in a directory.
  
  @param dir directory to evaluate
  @return number of inodes under it.
  @throws IOException