Bases: _Weakrefable
File and directory selector.
It contains a set of options that describes how to search for files and directories.
str
The directory in which to select files. Relative paths also work, use â.â for the current directory and â..â for the parent.
False
The behavior if base_dir doesnât exist in the filesystem. If false, an error is returned. If true, an empty selection is returned.
False
Whether to recurse into subdirectories.
Examples
List the contents of a directory and subdirectories:
>>> selector_1 = fs.FileSelector(local_path, recursive=True) >>> local.get_file_info(selector_1) [<FileInfo for 'tmp/alphabet/example.dat': type=FileType.File, size=4>, <FileInfo for 'tmp/alphabet/subdir': type=FileType.Directory>, <FileInfo for 'tmp/alphabet/subdir/example_copy.dat': type=FileType.File, size=4>]
List only the contents of the base directory:
>>> selector_2 = fs.FileSelector(local_path) >>> local.get_file_info(selector_2) [<FileInfo for 'tmp/alphabet/example.dat': type=FileType.File, size=4>, <FileInfo for 'tmp/alphabet/subdir': type=FileType.Directory>]
Return empty selection if the directory doesnât exist:
>>> selector_not_found = fs.FileSelector(local_path + '/missing', ... recursive=True, ... allow_not_found=True) >>> local.get_file_info(selector_not_found) []
Methods
Attributes
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4