Batch attach replaced PDFs

A place for users to ask each other questions, make suggestions, and discuss Bookends.
Post Reply
GJPhD
Posts: 43
Joined: Fri Mar 10, 2017 10:30 am

Batch attach replaced PDFs

Post by GJPhD »

I seem to have accidentally moved a large amount of PDFs from the Bookends iCloud Folder. I have over 11K references in Bookends, over 10K PDFs in my Bookends iCloud Folder, (previously) associated with the Bookends Library but the SQL No Attachment shows over 7K references without a PDF.

A substantial part of those 7K should have PDFs, as I label and tag each PDF I read. So when a reference is labelled and tagged, I know it has a PDF attached to it.

I am wondering if there is a way to batch (re)attach those PDFs again?

What got me into this possibility: When I manually search for a PDF in my Bookends iCloud Folder, there is a match between the reference (name) and PDF (file name) so I assume it would be possible for (some of the) PDFs. So for instance, Berry T (2020) is a reference in my library, has been read and labeled (green), but has no PDF: when I spotlight my Bookends iCloud Folder for Berry, it brings up the correct PDF, which I then manually attach. It would be quite tedious if I have to do this manually for all of them.
Attachments
Scherm­afbeelding 2023-07-05 om 22.50.08.jpg
Scherm­afbeelding 2023-07-05 om 22.50.08.jpg (246.13 KiB) Viewed 1148 times
Jon
Site Admin
Posts: 10073
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Batch attach replaced PDFs

Post by Jon »

The SQL group No Attachments searches the database for metadata in the Attachment field. When it reports a reference doesn't have an attachment it means the field is empty. Although you may indeed have accidentally moved PDFs, that would not affect the Bookends database, their names would still be there. One thing I would try is to Repair the library, in case there is some problem with the database.

Other things to consider:

1. If you have Time Machine, go back to a previous version of the library and see if they are there. If you don't have Time Machine, check out the backup in the Bookends Backup folder, on the off-chance they are in that database (and it hasn't been overwritten yet).

2. If you strike out on all of these, there is one last suggestion. Make sure the PDFs are in the same folder (I'd put them in a Desktop folder for this, to be sure they've all been downloaded from iCloud Drive, and for speed) and try Refs -> Get PDF -> Find & Attach Local PDF -> point Bookends to the folder with the PDFs. Bookends tries to match a Spotlight search it creates from each reference's metadata with the contents of the PDF. It's not terribly accurate, but even if it only matches 20% that's 2000. I'd make a backup of the library in the Finder before doing this.

Jon
Sonny Software
GJPhD
Posts: 43
Joined: Fri Mar 10, 2017 10:30 am

Re: Batch attach replaced PDFs

Post by GJPhD »

The last option was the first I tried, and it did a fine job with selecting the right PDFs.

There are still attachments missing from several references, butthose PDFs are somewhere in my Bookends iCloud folder and not that important for my current work. I'll add those manually in the future.

Thanks :)
Post Reply