Database table of contents to Obsidian

I’ve been looking for a way to create a TOC in DEVONthink, but I have had no luck. By TOC, I wasn’t thinking, at least initially, of an Obsidian-style TOC. I just wanted a list of resources I have stored in DEVONthink that I could print out for giving to colleagues, e.g., “Here’s a list of stuff I have. Anything interesting?”

I have many folders and sub-folders in my databases. It is not practical to dig down to the file level in each folder to be able to copy and paste the titles into a text document. I couldn’t see how DEVONthink could accomplish this. Then I thought, “What about Obsidian?” If Obsi could scan the database and return the title and DEVONthink link, it could create a document that could do this in Obsi. I couldn’t find a plugin that could do this.

The questions I have: 1) Is there currently a way to do this? 2) If not, how difficult would it be to create a plug-in for Obsidian or a DEVONthink automation to do it? I know there are plug-ins that interface with DEVONthink, so that doesn’t seem to be a problem in itself. (Caveat: I know nothing about creating plug-ins and would not even attempt it myself!).

Thank you.

You could select the files & folders in List view and then use Tools > Create Table of Contents.

It seems that the only way to do that is to go to the lowest folder level, where you can see individual files, and create the ToC there. I have a large number of folders under folders under folders… It is impractical to get to the file level in each of them.

I’m not certain why you can’t create a tree, maybe in OPML so it could be imported into a mindmap app.

You could script it. But it is not really obvious how to do that, since your requirements are a bit vague. Do you only want a list of “documents”, i.e. files? Or do you want the whole hierarchy of database(s), group(s), document(s) to be contained in your TOC?

The first variant needs about 10 lines of scripting.

The second one – well, one would have to recurse into every group, which takes time and is ugly to program.

1 Like

You could also use a smart group searching only for documents in these groups, then select the smart group’s results and use Tools > Create Table of Contents.

1 Like

Ideally, it would be choice 2. I think of it as the entire database morphed into a mind map, less the actual documents. I suppose as long as I’m dreaming, the document name could contain a link to the item in DEVONthink.

I wonder if it would be worth a developer’s time to create a stand-alone app that would accomplish this. Not sure how much of a demand there would be, but I know I would pay something for it.

I suppose I could use tags and get rid of all the folders, just keeping all the files at the top database level.Then the built-in TOC script would work.

Another idea: export the database and then use some shell commands like “find” to output the whole recursive folder listing.

i have used the “tree” command for this sort of thing. see mac tree command - Programmer Sought

An update.

I finally got around to devising a way to do this (sort of). I had initially wanted to get the TOC into Obsidian, as you can see from the post’s title, but I haven’t gotten that far. What I have done now is to take a DT database and end up with an iThoughtsX (included in Setapp) mindmap. That can be turned into an Outline using iThoughtsX’s View>Outline View after passing through MS Excel. This does basically what I need, so there is probably no need to get it to Obsidian, although that might be an interesting exercise.

I was using a DT database of 1,875 items. It probably took 5 hours to develop the concept and work out the bugs. Now it takes about 5 minutes to get from the database to an iThoughtsX outline. It might be interesting to automate it with something like KeyboardMaestro, but I can’t see running it more than once a month.

I just wanted to bring this up to date since it was never resolved.