Auto-updating list of files

What I’m trying to do

Create a list of files with links to them in my vault that match some sort of filter. Each time I open the note with the list, it gets updated (searches the vault for such files and lists them out). It would be nice if the filter could be implemented in JS.

Things I have tried

Currently I’m using Templater plugin to create a static list, that does not update. As Templater can only replace templates and insert them, it does not know the place where the template was after it got replaced with plain text (if I’m understanding correctly), that’s why it seems impossible to do that with Templater.

Dataview is likely what you are looking for.

2 Likes

I managed to make it with dataviewjs snippet. Here it is:

const files = app
	.vault
	.getFiles()
	.filter(file => file
		.path
		.endsWith(".mhtml")
	);
dv.table(["MHTML Files"], files.map(file => [dv.fileLink(file.path)]));

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