List of files inside folder

Things I have tried

I’m using this plugin and from what I found on the documentation, I can only get the name of the folder with this <% tp.file.folder() %>

I already asked for help in the discussion tab, I wanted to know if I could also get some help here.

What I’m trying to do

I want a template to display a bulleted list of all the files included in a specific folder in this format

- [[name of file 1]]
- [[name of file 2]]

The folder doesn’t include subfolders, only text files. Is this possible ?

I’m not sure, but I doubt Templater can do that.
But you can try another plugins, e.g., Dataview.

Dataview give me a list in preview mode, but I need to edit the list, so I need it in edit mode.
Thank you for your opinion. With all the functions, variables and commands in templater, I thought for sure it would have something like this, guess I was wrong.

Try Zoottelkeeper

If you want to “edit” the list, then your intent is that the list is not ‘dynamic’, i.e., the list doesn’t update automatically when you add a new file to your target folder.
In this case, you want a list in a specific moment (when created). For this you can make that list without any plugin:

  1. In file explorer select all the files inside your target folder and “drag and drop” them in your note;
  2. In Obsidian general search, write path:yourfolder and use the function “Copy search results” in the search menu.
1 Like

Thank you for the suggestion @jwl , but this plugin auto-generates that list in one file per folder, I need to manually generate this list in multiple files.

The idea was that it will dynamically generate the files under the folder whenever I use the template, but after that yes, it doesn’t update because I need to edit it.

I didn’t know about the drag and drop part. Thank you @mnvwvnm , it’s easy enough to solve my problem.

There is an amazing plugin called “text {{expand}}” that auto generates lists of notes as links based on a search.

For example, the following snippet (with the plugin installed and activated), creates a list (IN EDIT MODE AND IN PREVIEW MODE) of note links for my notes with the tag “cognitive_bias” that are not template files with “_TP” in the file name, and are not files with “000” in the name which I use for auto-generated MoC notes.

Again, the big draw here is that the links populate in Edit Mode, unlike Dataview that only shows output in Preview Mode.

```expander
cognitive_bias -_TP -000
```

2 Likes

Wow, exactly what I needed, thank you so much @Obsidandnancy

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