Is there a way to create an indented line for a subfolder within the grouped folder in list view?

The regex you’re using is pulling out the last folder of the related folder, so it’s make sense that it appears somewhere in your list. I think I’d rather approach this slightly different, and that is to remove the folder of your index file, and then group on the rest of the folder.

```dataview
LIST
rows.file.link
WHERE startswith(file.folder, this.file.folder)
GROUP BY regexreplace(file.folder, this.file.folder + "\/", "")
```

How does that look to you? This will display all sub-folders as separate items, and keep sub-folders connected with their parent folders. It’ll start the list with any files residing in the current folder.

Bonus tip: How to present code properly in a forum post

If you want to showcase either markdown, or code blocks, or dataview queries properly in a forum post, be sure to add one line before and one life after what you want to present with four backticks, ````. This will ensure that any other backticks (like for code blocks) is properly shown.

2 Likes