public static long sizeOf(Path path) throws IOException {
    SizeVisitor visitor = new SizeVisitor();
    Files.walkFileTree(path, visitor);
    return visitor.size;
  }
@Test
  public void sizeOf_ignores_size_of_non_regular_files() throws IOException {
    assumeTrue(SystemUtils.IS_OS_UNIX);
    File outside = temporaryFolder.newFile();
    FileUtils.write(outside, "outside!!!", UTF_8);
    File dir = temporaryFolder.newFolder();
    File child = new File(dir, "child1.txt");
    FileUtils.write(child, "inside!!!", UTF_8);
    File symlink = new File(dir, "child2.txt");
    Files.createSymbolicLink(symlink.toPath(), outside.toPath());

    assertThat(FileUtils2.sizeOf(dir.toPath()))
      .isPositive()
      .isEqualTo(FileUtils2.sizeOf(child.toPath()));
  }