Is there a way to clean up empty + unreferenced notes after import?

I’ve recently imported notes from Roam, and find myself with a lot of daily notes that are both empty and have no links to them anywhere else in my vault, probably because of the Roam way of auto-creating a daily note whether you write in it or not.

Is there a simple way to find & delete these notes in Obsidian? If not, does anyone know of an example of someone scripting this already? I would imagine it’s a matter of finding empty files, then searching the text of all files for occurrences of the empty files’ names (without the .md extension).

Anything else I’d need to be aware of before attempting this?

1 Like

You can use your system’s explorer to locate and delete empty files. Those will be 0 bytes in size.

1 Like

Ah, thank you! I’d known that, but for whatever reason assumed that since those files could be linked to from other files, deleting them would cause problems. But I see now that cmd+clicking on a reference like [[sidewalks]] when sidewalks.md doesn’t exist just instantly creates it so that I can write in it, but deleting it if empty causes no problems.

Thanks!

Yep. As soon as you create a wikilink, that note, even if it’s only virtual, will have meaning, becoming a node in the graph and showing every connection made to it.

1 Like