Auto hide empty folders

I’d like a way to automatically hide any folder that does not have any files that are visible to Obsidian. It would probably be useful to have some kind of toggle, just in case I do need to view those hidden folders - although I’d be happy enough even without a toggle.

Note that I know there are plugins that allow manually hiding folders, but this is not useful to me as I need the folders to auto-hide AND auto-unhide based on if relevant files (*.md) are present or not.

Why would I have folders in my vault that don’t have files (or at least no files visible to Obsidian)?

I want to use Obsidian to expose and allow navigation over a bunch of markdown files that are within a folder structure for a project. This project contains many other files (and folders) that are not-relevant to Obsidian.

Eg:
/project/images/…
/project/some-feature/otherfiles…
/project/some-feature/README.md
/project/some-feature/Something.md
/project/other-stuff/…, etc.

So in Obsidian I’d like it to build a tree/graph of the relevant documentation files (ie *.md) and hide all the rest of the folders that are not relevant.

Eg:
/project/some-feature/README.md
/project/some-feature/Something.md