SearchFolderInSystem - ViiSE/papka GitHub Wiki

SearchFolderInSystem

SearchFolderInSystem<T> - search folder by name in system.

Constructors

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.

Example

/*
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

Links

SearchFolder - implementable interface.

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