/** * Find the files in the given directory (and sub-directories) which match the given extension pattern(s). * * @param topDirectory * to start the search from. * @param recurse * @param patternList * comma seperated list of extensions to search for. * @return the list of files matching the given extension. */ public static List<File> findFilesForExtensions( File topDirectory, boolean recurse, String patternList ) { List<File> result = new LinkedList<File>(); if ( topDirectory.isDirectory() ) { FilenameFilter f = buildFilenameFilter( patternList ); findFiles( topDirectory, result, recurse, f ); } return result; }