public static long getDirectorySize ( Path path , FileSystem fs , PathFilter filter ) throws IOException { PathSizeVisitor visitor = new PathSizeVisitor ( ) ; PathFilter composite = new PathFilters . CompositePathFilter ( PathFilters . newExcludeDirectoriesFilter ( fs . getConf ( ) ) , filter ) ; walkPath ( path , fs , composite , visitor ) ; return visitor . getSize ( ) ; }
Calculates the total size of all the contents of a directory that are accepted by filter . All subdirectories will be searched recursively and paths in subdirectories that are accepted by filter will also be counted .