Dataview/Dataviewjs

I’ve been looking around the internet and can’t find an answer to this one…

Is there a way to use Dataview/Dataviewjs to get a list of the sub-folders within a folder?

Hi.

You can try this:

```dataview
LIST
FROM "your folder"
GROUP BY split(file.folder, "/")[1] AS sub-folders
WHERE sub-folders
```
  • FROM "your folder"> “yourfolder” is your parent folder

  • split(file.folder, "/")[1] > this example works if your parent folder is in level one in relation to root vault, because split(file.folder, "/")[1] do this: take the path of any file in sub-folder (similar to “topfolder/subfolderA”) and split path by “/” (you get “topfolder” + “subfolderA”), then “[1]” means «choose the second part» ("[0]" means the first) and you get “subfolderA”

  • sub-sub-folders are excluded from list!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.