Index with dataview for all pdf files?


i hope someone can help me :slight_smile:

how can i list all external files in my vault?

for example all pdf files?

i have already tried this, unfortunately without success

list from ""
where contains(file.extension,"pdf")
1 Like

First point: define “external files”? are they placed in vault?
Second point: if they’re placed in vault you can’t achieve this via simple dataview. You can use dataviewJS and access to API with something like app.vault.getFiles().filter(file => file.extension == 'pdf'

1 Like

thank you for the feedback.

it is complicated for me
how exactly can i do this?
all my pdf files are in folder X in the vault

it does not work like this

app.vault.getFiles().filter(file => file.extension == 'pdf'

Evaluation Error: SyntaxError: missing ) after argument list
at DataviewInlineApi.eval (plugin:dataview:19669:21)
at evalInContext (plugin:dataview:19670:7)
at asyncEvalInContext (plugin:dataview:19680:32)
at DataviewJSRenderer.render (plugin:dataview:19701:19)
at DataviewRefreshableRenderer.maybeRefresh (plugin:dataview:19279:22)
at t.e.tryTrigger (app://
at t.e.trigger (app://
at t.trigger (app://
at DataviewPlugin.eval (plugin:dataview:20684:76)
at a (app://

Try something like

const pdfFiles = app.vault.getFiles().filter(file => file.extension === 'pdf')
dv.list( => dv.fileLink(file.path)))

If you want to specify the folder:

const pdfFiles = app.vault.getFiles().filter(file => file.extension === 'pdf' && file.path.includes('MyFolder'))
dv.list( => dv.fileLink(file.path)))

thank you :slight_smile:

this has helped me a lot. :pray:

have a nice time :slight_smile:

For a more effective organization of this forum, if you consider this help solved, please close this topic selecting the “solution”.

1 Like

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