I have imported several thousand notes from various external sources. On review I sometimes find a caption within a note that states some file (usually a PDF) “is not created yet”. When found I can go back to the source and correct the situation.
As I intend to cease utilizing some of these sources very soon, I would like to fix all such files first. How can I search for and find all notes in my vault that have such a notation within them? I have tried every kind of search I can find and none find this phrase. I even tried the search in Apple Finder. Alas, the verbiage is added by Obsidian and is not part of the .md file.
thanx,
Ken
I was going to suggest the “Dangling Links” plugin. But it only works on links that are not embedded.
So [[Bad_link.pdf]]
will show up. And ![[Back_link.pdf]]
will not. Maybe that’s a feature request for that plugin.
But then I found this Reddit post, with a Dataview query that finds both, and some additional ideas and comments.
And there is likely a way to filter only by “pdf” in the name, but I don’t know how to write dataviewjs queries.
Thanx, rigmarole… Like you mentioned the Dangling Links plugin doesn’t provide the data I’m looking for.
As for the Dataviewjs query, it did give me some stuff that I needed to correct. But it did not provide the titles of notes that contain “is not created yet”. That is what I would like to have. Unfortunately, I do not know JavaScript and I am very new to Dataview having only used it one time.
I guess I’ll just hope someone else out there can assist me.
Thanx again,
Ken
I edited one of the examples. They had filtered only if there were more than 5 links to a certain empty link. I removed that limitation, and simplified the output a bit to not include the empty link over and over in each row:
This creates a grouping, sorted by frequency of an empty link, and all the pages that link to it. So you can click on the “empty link” to create it. Or you can click on the “real note” link to go and repair the broken link.
- EMPTY LINK (4):
- Real Note A
- Real Note B
- Real Note C
- Real Note D
- Missing File.pdf (1):
```dataviewjs
//Min Number of link before showing up
const InterestLevel = 0 ;
//"hash" the missing links to find similar one (uppercase, space) could use some lemmatization.
//const hashMissingLink = ( x ) => x.toUpperCase()
const hashMissingLink = ( x ) => x.toUpperCase().replace(/[\s/\\]+/,"")
const r =
Object.entries(dv.app.metadataCache.unresolvedLinks)
.filter( ( [k,v] )=> Object.keys( v ).length )
.flatMap( ( [k,v] ) =>
Object.keys( v ).map(x =>
({ key: hashMissingLink( x )
, originalLink : dv.fileLink( x )
, source: `- ${ dv.fileLink( k ) }`
})
))
.sort( (a,b) => dv.compare( a.key, b.key ) )
dv.list(
dv.array( r )
.groupBy( t => t.key )
.where( t => t.rows.length > InterestLevel )
.sort( t => t.rows.length , "desc")
.map( t => t.rows[0].originalLink + " ("+t.rows.source.length+"): \n" + t.rows.source.join("\n") + "" )
)
```

I don’t know if this will help your particular situation but there’s a Community plugin called Janitor which can list, and selectively delete, any ‘orphaned’ files in your vault. I sometimes use it to find PDFs or images that have somehow become unattached from notes. If I see a PDF in the list, I can open it in my file manager to see what it contains, if it’s not obvious from the file name, to get an idea which note it was originally attached to. This can be a painful job if you have lots of orphaned files, especially as Obsidian often gives attachments filenames that no human would use. But it has often turned out to be the quickest way of getting the job done.
Thanx, rigmarole. I gave that a try. Although it leaves a lot to be desired because of the work involved in searching out and finding what’s needed to fix things, it sure does provide a roadmap to follow. Pretty much what I asked for. Thanx again!
Too bad some smart Obsidian gurus don’t write a plugin to do this. They could add stuff to ease the effort. For example, after finding the .md filer like your dataviewjs does it would be nice if it could be clicked and jump directly to where the mishap is located. But alas, I would suppose that there may not be that much call for such a thing.
Regardless, I’ll make plenty of good use of your effort that’s for sure!
Thanx, garryknight. Great suggestion. I am using the Janitor plugin although I haven’t been eyeballing it as much as you. I will though in the future. Your suggestion has enlightened me. Thanx!
1 Like
I ran into this problem today. What was particularly weird is that I use a davatiewjs script to display directory contents and the file in question appeared there even though it would say “not yet created” when I hovered over the link. I eventually figured out that the problem was a “#” in the filename. As soon as I removed that, everything worked as it should.