I’m trying to create a table that lists the subfolders inside a folder, and the files inside the subfolders, like this
I can’t find how to do this with the Dataview table query, I assume it needs Dataview JS but I don’t enough knowledge on JS, to make sense of the table code I am seeing online.
I found this forum post with a similar concept, except the code there formats the results as a bulleted list.
For this table I only want to list one layer of subfolders inside the main folder, there are no sub-subfolders inside those subfolders.
Is there anyway to do this with Dataview?
Help much appreciated. Thanks!
```dataview
TABLE join(sort(rows.file.link), " | ") as Files
FROM "My/Start/Folder"
FLATTEN Regexreplace(file.folder, ".*/", "") as lastPart
GROUP BY lastPart as Folder
SORT lastPart
```
Not entirely sure if sorting the links works as expected, and the replace would fail if multiple subfolders exists. Then you might be better off doing something like substring(file.folder, xxx) where xxx is the length of your base folder.