ConfigUtil { List<CfgFile> getFilesFromDirectory(File directory, FilenameFilter filter, boolean recurse) { File [] files = directory.listFiles(); List<CfgFile> ret = new ArrayList<>(); for(File f:files) { if(f.isDirectory() && recurse) { ret.addAll(getFilesFromDirectory(f, filter, recurse)); } else if(filter.accept(f.getParentFile(), f.getName())) { ret.add(new CfgFile(f)); } } return ret; } ConfigUtil(Configuration saxonConfig, URIResolver uriResolver, String configUri);  ConfigUtil(Configuration saxonConfig, URIResolver uriResolver, String configUri, final boolean skipSchemaValidation, final String currentDir); Config buildConfig(HashMap<QName,ParameterValue> inputParameters); static QName resolveQName(String name); static void addConfigParameter(Config config, String parameterPattern, DatatypeFactory factory); static ParameterValue parseParameterPattern(String parameterPattern, DatatypeFactory factory); static void setNbThreads(Config config, String argument); static void addInputFile(Config config, String argument, DatatypeFactory factory); static void addTemplate(Config config, String argument, DatatypeFactory factory); static void setOutput(Config config, String argument);  }
@Test public void testFindFilesRecurse() throws InvalidSyntaxException { GauloisPipe piper = new GauloisPipe(configFactory); ConfigUtil cu = new ConfigUtil(configFactory.getConfiguration(), piper.getUriResolver(), "cp:/cp-xsl.xml"); final Pattern regex = Pattern.compile(".*\\.xml"); FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String filename) { boolean match = regex.matcher(filename).matches(); return match; } }; List<CfgFile> files = cu.getFilesFromDirectory(new File("src/test/resources/findDir-recurse"), filter, true); assertEquals("5 files are expected ", files.size(), 5); }