public static long getDirectoryFilesSize(java.nio.file.Path path, FileVisitOption... options)
            throws IOException {

        if (path == null) {
            return 0L;
        }

        try (Stream<java.nio.file.Path> pathStream = Files.walk(path, options)) {
            return pathStream
                    .map(java.nio.file.Path::toFile)
                    .filter(File::isFile)
                    .mapToLong(File::length)
                    .sum();
        }
    }
@Test
    void testGetDirectorySize() throws Exception {
        final File parent = TempDirUtils.newFolder(temporaryFolder);

        // Empty directory should have size 0
        assertThat(FileUtils.getDirectoryFilesSize(parent.toPath())).isZero();

        // Expected size: (20*5^0 + 20*5^1 + 20*5^2 + 20*5^3) * 1 byte = 3120 bytes
        generateRandomDirs(parent, 20, 5, 3);
        assertThat(FileUtils.getDirectoryFilesSize(parent.toPath())).isEqualTo(3120);
    }