SearchFilesByFolderNameInSystem - ViiSE/papka GitHub Wiki

SearchFilesByFolderNameInSystem

SearchFilesByFolderNameInSystem - search files in filesystem by folder name.

Constructors

public SearchFilesByFolderNameInSystem(String beginWith)


String beginWith - name of the folder to start the search from.

Example

List<File> files = new ArrayList<>();
files.add("/home/doc1/doc1_file1.png");
files.add("/home/doc1/doc1_file2.pdf");
files.add("/home/doc1/folder1/folder1_file1.png");
files.add("/home/doc1/folder2/folder2_file1.pdf");
files.add("/home/doc2/file1.txt");
files.add("/home/doc2/file2.pdf");
files.add("/home/doc3/file1.mp3");

String beginWith = "/home/doc1/";
Search<List<File>, String> search = new SearchFilesByFolderNameInSystem<>(beginWith);
List<File> files = search.answer(".*");
files.forEach(file -> System.out.println(file.getName()));
Output:

doc1_file1.png
doc1_file2.pdf
folder1_file1.png
folder2_file1.pdf

Links

Search - implementable interface.

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