public static void eachFile(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 (fileType == FileType.ANY || (fileType != FileType.FILES && Files.isDirectory(path)) || (fileType != FileType.DIRECTORIES && Files.isRegularFile(path))) {
        closure.call(path);
      }
    }
  }
 }

public static void eachFile ( 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 ( fileType == FileType . ANY || ( fileType != FileType . FILES && Files . isDirectory ( path ) ) || ( fileType != FileType . DIRECTORIES && Files . isRegularFile ( path ) ) ) { closure . call ( path ) ; } } } }
invokes the closure for each ' child ' file in this ' parent ' folder / directory . both regular files and subfolders / subdirectories can be processed depending on the filetype enum value .
