Dataview query to use in a template, to list file versions

What I’m trying to do

(on mobile, android).
Make a dataview query that can be inserted into a page via a template, that will list any files named with variations of the base file name. -1, -2, etc appended to the base name. Or since I’m not consistent I may end up with filename.1.md, file name.2.md. Sloppy, I know.

Example: lets say I am working on today’s daily note. I use YYYY-MM-DD-ddd for my format so I’d want to list all files that were named 2025-05-07-Wed.md, 2025-05-07-Wed-1.md, 2025-05-07.2.md, etc. This is my admittedly sloppy idea of file versioning, so showing file last modified date/time would be helpful too.

Keep track of file copies made while editing, so I can try out chunks of code, have a backup, etc. At the end or some time in the future I sort them by date in file manager, then review and decide what to.delete or archlve.

Things I have tried

  1. Searched the web for someone asking how to do this, hoping to read the replies they got.
  2. Told AI what I want to do.
  3. Looked at a dataview info page for insight.
  4. Refined my question and asked AI again, based on it’s earlier answers. This time it said to incorporate regex into my query. " plaintext
    -regex(file.name, “^{{date)}. *”)
    | sort by modification time ". I don’t know regex or dataview so here I am.

Hello.

Would something like this work for your needs?


```dataview
TABLE
WHERE contains(file.name, this.file.name)
```

1 Like

Thank you, but for whatever reason your solution is not working here. As in using that exact code, nothing shows except the code itself.

I have two other queries on the page and they both work. The following is one of them. I only show this for possible insight as to why one works but not the other.

Notes last touched today

List FROM "" WHERE file.mday = date("<%tp.date.now("YYYY-MM-DD")%>") SORT file.mtime asc

Hi.

I don’t use Templater, but if I copy your query into a test file and enter a date, it works fine, alongside the query I suggested above, plus another simple test query.

## Q1

```dataview
TABLE
WHERE contains(file.name, this.file.name)
SORT file.mtime asc
```

# Q2

```dataview
List FROM "" 
WHERE file.mday = date("2025-05-07") 
SORT file.mtime asc
```

## Q3

```dataview
TABLE
WHERE file.name = this.file.name
```