class FileSystemUtils {

    static long countSubDirectories(Path path) {
        try (Stream<Path> stream = Files.walk(path)) {
            // skip first to avoid counting input directory
            return stream.skip(1).filter(Files::isDirectory).count();
        } catch (IOException e) {
            throw new RuntimeException(e.getMessage(), e);
        }
    }

    private  FileSystemUtils();

}