public static void walkPath ( Path path , FileSystem fs , PathFilter filter , PathVisitor visitor ) throws IOException { FileStatus fileStatus = fs . getFileStatus ( path ) ; if ( filter . accept ( path ) ) { visitor . visit ( fileStatus ) ; } if ( fileStatus . isDir ( ) ) { FileStatus [ ] children = fs . listStatus ( path ) ; for ( FileStatus childStatus : children ) { walkPath ( childStatus . getPath ( ) , fs , filter , visitor ) ; } } }
Recursively walk a path applying visitor to each path accepted by filter