Checking for broken x-devonthink-item:// links in database

My database is rife with x-devonthink-item:// links—hundreds if not thousands of them. Unfortunately, through the years, for one reason or another, a number of these links have been broken.

In the vast majority of cases the destinations of these links still exist but have only moved to another x-devonthink-item:// link.

It would be tremendously helpful to have a (semi-) automated way to track these broken links down. At the very least, broken links could be indicated in another color, e.g. red, when the document is rendered. Ideally, on the other hand, I could imagine a utility under “Tools” with an interactive dialog for repairing these links. Or, as a workable compromise, a script that lists all documents that contain at least one broken link.

Thoughts? Solutions? Many thanks.

Moving items to different databases shouldn’t break such links, only deleting the targets should break them.

Thanks, Christian. Actually, I’ve never moved items between databases. What I have done a few times, albeit inadvertently, is rename or move indexed files to a different folder. Not a terribly large number but, in the course of several years, enough to prod me to look for a good solution.

Is a script or similar solution conceivable?

Perhaps the biggest downside to indexing documents in DEVONthink is that there is no way to recover when documents and/or indexed folders are renamed or moved in the Finder.

That’s true (although it may not have to be that way: BibDesk (which I feel comfortable mentioning here as a non-competing product in a different category) utilizes OSX aliases for the files it indexes, thereby preserving links even if the file is moved or renamed).

In any case, accidents happen, files do get moved around, and it would be very handy to have a tool or hack for tracking down broken links (or at least color-coding them).

Strictly speaking, actually, I would argue that the “Verify Database” tool should also check for broken links, inasmuch as it is difficult to call a database “verified” (from the user’s perspective) if it has such links.

Verify & Repair does check for broken links. Move or rename an indexed document or folder, and this is what Verify & Repair will report.

Log entry.

Apologies, I was probably not clear.

I was referring to x-devonthink-item:// links used to tie documents together in wiki-like fashion. I use these links in my Markdown documents (Markdown being my format of choice for most of my work). For example:

This is a research note. Bla bla bla. Also [see this document](x-devonthink-item://2EDBDD7C-9B79-4E93-AAB6-206174DA27FF).

It is broken links of that sort that I would like to track down.

Got it, although I believe the scope of Verify & Repair is to test and repair, if possible, the database structure. Checking for broken links to other resources is a different process. What I would like to see in DEVONthink is the ability to search for/relink missing documents when they first appear in Verify & Repair. I seldom, if ever, get bitten by this behavior these days but I do recognize that it is a challenge. Nothing like having V&R tell the user that there are thousands of missing files because an indexed folder was renamed in the Finder.