obsidian-dataview
obsidian-dataview copied to clipboard
Exclude subfolders?
Is there a way to exclude subfolders from a list so that the results display only those pages that are in a root folder? I've tried
list from "Recipes"
where !contains(file.path, "Recipes/")
The forward slash is not understood as part of the exclusion until a letter is added after it, e.g., "Recipes/A", "Recipes/B", etc. which means each subfolder would need to be explicitly excluded.
Hmm, I should look into an easier way of doing it, but you can achieve this with regexmatch:
LIST FROM "Recipes"
WHERE regexmatch("Recipes/[^/]+.md", file.path)
This effectively discards any paths which have another '/' in them (i.e., in a subfolder).
I'd like to add to this, along with excluding subfolders, I feel it'd be important (and useful) to be able to indent the subfolders' contents if you don't want to exclude them.
This would enable you to build a full, proper index.
@firinael can you explain what you mean by "indenting contents"?
Closing as duplicate of #66