Help with dataviewjs query. Obsidian doesn't treat media as pages of their own

Things I have tried

What I’m trying to do

I tried the following dataviewjs query to list the music in a folder

$=dv.list(dv.pages('"Personal Space/Fun Space/music"').sort(f=>f.file.name,"desc").filter(function(f) {return f.file.name.indexOf('Index') === -1;}).file.link)

However, it does not return any page which is effectively media that I had copied in the folder from the system explorer. All the media is readable and playable by Obsidian. Any way around this?

Dataview only reads Markdown files, nothing else

So is there no way I can list other files? Maybe alternative plugins?

it’s still possible inside of a DataviewJS codeblock, just not using the Dataview provided methods.

This uses the Obsidian API, it does not take subfolders into account.

const files = app.vault.getAbstractFileByPath("Personal Space/Fun Space/music").children
	.sort(file => file.name)
	.filter(file => !file.name.includes("Index"))
	.map(file => dv.fileLink(file.path));

dv.list(files);

Also try using Code blocks and not inline, they make reading your code easier.

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