Indexing a folder with already-indexed files

TL;DR: if I have a group of indexed files, but the Group is not indexed, what’s the best way to get the group indexed, too? Should I do File→Index Files and Folders and select the group, or should I deconsolidate the group folder using scripting?

The story: I’m trying to merge my Bookends and DT3 reference libraries. I plan on keeping the files for the references on my file system in Bookends’ attachment folder and indexing that folder in DT3. I have modified the fantastic “Export to Bookends” script Christian created to accommodate the folder hierarchy I like to use (namely grouping these (numerous) items by which year & semester I first encountered them, as an arbitrary way to avoid a group of 5000+ records).

The script works fantastically, except that only the records get deconsolidated—the hierarchy of folders they reside within remain in the database, even though the modified script recreates that hierarchy on the file system.

So, should I:

  • Do a File → Index Files and Folders on the non-deconsolidated groups;
  • Manually run a Deconsolidate script action on each of these non-deconsolidated groups;
  • Modify the script to deconsolidate those groups as it runs; or
  • something else entirely?

(I haven’t acted on this plan, yet. Just making sure nothing major will break before I do.)

Why not create a new indexed Group with the contents you wish - then delete the original group (choosing to delete those items “in database only”)?

Hm. That could work, I think, but it doesn’t seem ideal—the groups (will) already exist in both DT and the filesystem, so it will be a little weird to create a new group that I can index to make this work.

Still, it’s probably a functional workaround that I’ll use if nobody else has a better suggestion!

I’d think about other strategic option: store items in DT, and reference them as attachments in Bookends. It is more stable, and you can change locations in DT and groups in BE afterwards as you wish.
My integration of DT and BE is based on this

1 Like

Hm. Perhaps I haven’t thought through how that would work. I am ultimately trying to automate how to add a new item to both DT and Bookends with minimal manual intervention. I suppose the same Export to Bookends script could be used while keeping attachments in DT…

How do those attachments work in Bookends on iOS/iPadOS? (Edit: I will test this myself when I get a chance.)

I don’t work with the mobile version of BE, so for me it’s just DTTG. You may comment in BE or DT, - while you use standard PDF annotation tools, you can see it in both apps. It means you can see it in DTTG too. No need for mobile BE version.
How things are set up in my DT and BE integration:

  • New entry may appear first in DT (some interesting PDF without reference data) or in BE through a ref database search. This way or other you have ref in BE and PDF in DT. Then with a single hot key (script) you do the following:
    • Add double-entry to connect Ref to PDF (this adds DT UUID to user4 field of BE, and BE ID to custom MD in DT). This allows in future to use a hot key to quickly switch from Ref in BE to PDF in DT and back
    • In BE it adds a DT PDF as an attachment to the selected Ref
    • In DT it:
      • adds a list of all BE groups this Ref is in to specific Custom MD field
      • writes the date of this sync to specific Custom MD field
      • writes the full reference in selected BE format to specific Custom MD field
      • writes all Notes from BE to Finder Notes in DT
      • writes ref URL (if useful) to the URL field in DT
      • renames PDF in DT using simple separate BE format, like “Surname of the first author (year) Main part of the title.pdf”
      • writes PDF property fields “Author” and “Title” using EXIF tool and data from BE
  • Then there is a smart rule script which on a weekly basis oversees if there are any changes in the BE or DT. If it finds any it writes the appropriate status to the Custom MD field.
  • Then another smart rule updates all last changes and try to repair double-entry errors if any, and changes the BE status, like “udated”, or “repared”. The most frequent reason for such repairs is when you OCR your PDF (UUID changes), or accidentially change BE ID in DT.

Wow! Thanks for the write up. That sounds about the same as what I was aiming for, although I do want mobile BE for easy cite-while-you-write on mobile.

Any chance you can share the script(s) you mention?

No problem, they are “as is”, so tune them up.
DT and BE integration (2.4 MB)

I think “cite-while-you-write” will be available, but not sure if you will be able to read and annotate attachments via BE mobile in this setup.


Sadly—but intuitively—Bookends iOS-synced files using this method turn into duplicates on the mobile library. If you make changes to a file (e.g. annotations) in Bookends iOS, you need to sync those changes back to Bookends macOS for DT to pick up the changes and vice versa.

I suppose the same thing would be true of indexed files, though. Round-tripping of some sort will still be required to keep the records the same everywhere. Perhaps I shouldn’t worry about attachments on Bookends iOS and just use item-links as you describe, @Silverstone. Hmmm.

Shoot. Just to keep reporting details here, it seems the nice view of a PDF’s annotations that Bookends provides depends on the attachment. So if you sync your references to iOS without attachments, Bookends doesn’t show any annotations, even if they display on Bookends macOS.

So I suppose getting reference PDF files onto Bookends is important to me. I just have to figure out the best way to do so (e.g., minimizing duplication and round tripping)…

Yes, you will have to experiment here, since I never used mobile apps for writing and referencing. On OSX all works just fine.

It seems to me that this is a kind of question to Sunny software: we show to BE OSX app where attachment is on the disk, why cannot BE iOS to sync all correctly? You may try to ask a question on BE forums, author is very responsive and may suggest a solution or workaround.

1 Like

Thanks again for sharing these scripts. I’ve riffed on them to develop my own, and I’ll share as soon as they’re nice and robust.

First, though, a question: Bookends often fails to pick up the attachment in the DEVONthink Files.noindex/pdf/ directories. I’m guessing that this will resolve itself once I’ve manually attached a PDF from each directory as per Jon’s guidance here. Still, it seems finicky. So, the question: have you set Files.noindex/pdf/ as the default directory for Bookends? I know that that is not advised as per @BLUEFROG—if you have, have you run into any issues with it?

I know that that is not advised as per @BLUEFROG—if you have, have you run into any issues with it?

No, you should NOT be doing this, with Bookends or any application.

1 Like

Ha, thanks, I acknowledge the potential problems and I’m not doing it myself. Just curious about others’ experiences. (Why is it such a bad idea, by the way?)

You should not mess about in the internals of a DEVONthink database, including adding/removing/renaming files. If you do, you are causing inconsistencies in the database.

1 Like