code: public static int count(File path, FileFilter fileFilter) {
      int count = 0;
  
      for (File file : safeListFiles(path, fileFilter)) {
        count += (isDirectory(file) ? count(file, fileFilter) : 1);
      }
  
      return (ComposableFileFilter.and(FileUtils::isFile, fileFilter).accept(path) ? 1 : count);
    }
docs: Counts the number of files in the given file system path accepted by the given {@link FileFilter}.  If path
  is a file then this method returns 1. If path is a directory then this method will recursively visit all
  sub-directories, counting all the files contained within the given path excluding the path itself.
  
  @param path the file system path to evaluate.
  @param fileFilter the {@link FileFilter} used to evaluate the {@link File} and determine whether
  it is to be included in the count.
  @return an integer value indicating the number of files contained in the given file system path.
  If path is a non-null file then this method returns 1.
  @see java.io.File
  @see java.io.FileFilter
  @see #safeListFiles(File)
  @see #isDirectory(File)