What I’m trying to do
For some sync reasons, there are multiple notes having same name but located in different places in my vault. And unfortunately, there could be many such notes and i don’t know their names.
I want to find out the notes whose name is shared by more than one note and check if I should keep all of them or delete the duplicated one(s).
Things I have tried
I have no clue right now.
You could try one of these?
@PitchPowerBank here’s a one-liner that will find any duplicate note names:
const duplicates = app.vault.getFiles().filter((x, _, a) => x.name.match(/\.md$/) && a.filter(y => y.name === x.name).length > 1).map(x => x.path)
You could use Dataview to display the list of files for you:
const duplicates = app.vault.getFiles()
.filter((x, _, a) => x.name.match(/\.md$/) && a.filter(y => y.name === x.name).length > 1)
.map(x => x.path)
If you wanted you c…
I tried the second ```dataviewjs example AlanG shared, and all my duplicate note names were listed. Not so many for me, but I found a few I had no idea about.
May 16, 2023, 12:13am
The dataview js code works perfectly.
I had about 20-30 duplicated notes. The reason i guess is that I was using iCloud during that period of time and moved a lot of notes and folders. And they are copied to the new location but the original ones are left behind without being deleted.
May 23, 2023, 12:14am
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.