private static void collectMatchedFiles( @NotNull File absoluteRoot, @NotNull File root, @NotNull Pattern pattern, @NotNull List<File> files) { final File[] dirs = root.listFiles(); if (dirs == null) return; for (File dir : dirs) { if (dir.isFile()) { final String relativePath = getRelativePath(absoluteRoot, dir); if (relativePath != null) { final String path = toSystemIndependentName(relativePath); if (pattern.matcher(path).matches()) { files.add(dir); } } } else { collectMatchedFiles(absoluteRoot, dir, pattern, files); } } }
public static void collectMatchedFiles( @NotNull File root, @NotNull Pattern pattern, @NotNull List<File> outFiles) { collectMatchedFiles(root, root, pattern, outFiles); }