question: public static void eachFileRecurse ( final Path self , final FileType fileType , @ ClosureParams ( value = SimpleType . class , options = "java.nio.file.Path" ) final Closure closure ) throws IOException { checkDir ( self ) ; try ( DirectoryStream < Path > stream = Files . newDirectoryStream ( self ) ) { for ( Path path : stream ) { if ( Files . isDirectory ( path ) ) { if ( fileType != FileType . FILES ) closure . call ( path ) ; eachFileRecurse ( path , fileType , closure ) ; } else if ( fileType != FileType . DIRECTORIES ) { closure . call ( path ) ; } } } }
target:  Invokes the closure for each descendant file in this directory. Sub-directories are recursively searched in a depth-first fashion. Both regular files and subdirectories may be passed to the closure depending on the value of fileType.