Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Get all pdf
- ```dataviewjs
- const pdfFiles = app.vault.getFiles().filter(file => file.extension === 'pdf')
- dv.list(pdfFiles.map(file => dv.fileLink(file.path)))
- ```
- ## Get pdf by folder
- ```dataviewjs
- const pdfFiles = app.vault.getFiles().filter(file => file.extension === 'pdf' && file.path.includes('92 - Rocketbook'))
- dv.list(pdfFiles.map(file => dv.fileLink(file.path)))
- ```
- ## Get pdf by folder and file name (tag)
- ```dataviewjs
- const filter = '[Workflow]'
- const pdfFiles = app.vault.getFiles().filter(file => file.extension === 'pdf' && file.path.includes('92 - Rocketbook') && file.path.includes(filter))
- dv.list(pdfFiles.map(file => dv.fileLink(file.path)))
- ```
- ## Get pdf for current note (current file name)
- ```dataviewjs
- const filter = '[' + dv.current().file.name + ']'
- const pdfFiles = app.vault.getFiles().filter(file => file.extension === 'pdf' && file.path.includes('92 - Rocketbook') && file.path.includes(filter))
- dv.list(pdfFiles.map(file => dv.fileLink(file.path)))
- ```
- ## Get pdf for studytopic
- ```dataviewjs
- let pg = dv.current()
- let studytopic = pg.studytopic.replace(/[%]+/g,'');
- dv.span('studytopic: ' + studytopic);
- const allPdfFiles = app.vault.getFiles().filter(file => file.extension == 'pdf' && file.path.includes(studytopic));
- dv.list(allPdfFiles.map(file => dv.fileLink(file.path)));
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement