SearchFilesByRegex - ViiSE/papka GitHub Wiki
SearchFilesByRegex - search raw files in folder by regex.
public SearchFilesByRegex(Folder<T> folder, boolean includeChildren)
Folder<T> folder - folder to search in;
boolean includeChildren - to do a full depth-first search, include all children? (default false)
public SearchFilesByRegex(Folder<T> folder)
Folder<T> folder - folder to search in.
List<String> rootFiles = new ArrayList<>();
rootFiles.add("root1.png");
rootFiles.add("root2.pdf");
rootFiles.add("childRoot1.pdf");
rootFiles.add("childRoot2.pdf");
List<String> child1 = new ArrayList<>();
child1.add("child1.txt");
child1.add("child1.png");
List<String> child2 = new ArrayList<>();
child2.add("child2.txt");
child2.add("child2.png");
List<String> child2_1 = new ArrayList<>();
child2_1.add("child2_1.txt");
child2_1.add("child2_1.png");
Folder<String> folder = new FolderPure<>(
new NameFolderRoot(),
rootFiles,
new FolderPure<>(
"/child1",
child1),
new FolderPure<>(
"/child2",
child2,
new FolderPure<>(
"/child1/child2_1",
child2_1))
);
Search<List<String>, String> search = new SearchFilesByRegex(root);
List<String> files = search.answer("^child.*$");
files.forEach(System.out::println);
Output:
childRoot1.pdf
childRoot2.pdf
Search - implementable interface.