SearchFolderInSystem - ViiSE/papka GitHub Wiki
SearchFolderInSystem<T> - search folder by name in system.
public SearchFolderInSystem(OsRepository osRepo, String beginWith)
OsRepository osRepo - to determine the current OS (default - OsRepo);
String beginWith - name of the folder to start the search from.
/*
We have following files in 'doc' folder:
/home/doc1/file1.txt
/home/doc1/file2.pdf
/home/doc2/file3.txt
/home/doc2/file4.txt
/home/doc2/file5.svg
*/
String beginWith = "/home";
Search<Folder<File>, String> search = new SearchFolderInSystem(beginWith);
Folder<File> root = new SearchByContains(search).answer("doc1");
root.traver(folder -> {
System.out.println(folder.fullName());
folder.files().forEach(file -> System.out.println("\t" + file.getName()));
});
Output:
/home
doc1
file1.txt
file2.txt
SearchFolder - implementable interface.