SearchFilesByFolderNameRegex - ViiSE/papka GitHub Wiki

SearchFilesByFolderNameRegex

SearchFilesByFolderNameRegex<T> - search files belonging to a folder by its name.

Constructors

public SearchFilesByFolderNameRegex(Folder<T> folder, boolean isFullName)


Folder<T> folder - folder to search in;
boolean isFullName - is the search for the full folder name or not? (default true)
public SearchFilesByFolderNameRegex(Folder<T> folder)


Folder<T> folder - folder to search in.

Example

List<String> rootFiles = new ArrayList<>();
rootFiles.add("root1.png");
rootFiles.add("root2.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 SearchFilesByFolderNameRegex<>(folder);
List<String> files = search.answer("^/child2.*$");
files.forEach(System.out::println);
Output:

child2.txt
child2.png
child2_1.txt
child2_1.png

Links

Search - implementable interface.

⚠️ **GitHub.com Fallback** ⚠️