INNER CODE UNIT · Python
include_root
mfarragher/obsidiantools · obsidiantools/_io.py:30
include_root: bool = True) -> list[Path]:
"""Get list of relative paths for {extension} files in a given directory,
filtered to include specified subdirectories (with include_subdirs
kwarg). The default arguments align with get_relpaths_from_dir
function, but this function enables more flexibility.
For example, if you had a vault with folders named by category, and
filter them like this in Obsidian:
path:Category1/ OR path:Category2/ OR path:Category4/
then you can use the include_subdirs kwarg to do that with this function:
include_subdirs = ['Category1', 'Category2', 'Category4']
You can also specify deeper levels to filter on, e.g.:
include_subdirs = ['Category1/TopicA', 'Category1/TopicB']
Args:
dir_path (pathlib Path): Path object representing the directory
to search.