public static long sizeOf ( Path path ) throws IOException { SizeVisitor visitor = new SizeVisitor ( ) ; Files . walkFileTree ( path , visitor ) ; return visitor . size ; }
Size of file or directory in bytes . In case of a directory the size is the sum of the sizes of all files recursively traversed .