Fixing batches of broken attachment links & identifying broken paths across the system

In rearranging some linked attachment files several years ago, I broke quite a few links. I didn't worry about the cleanup, because I knew Zutilo could do it. But it's my understanding that Zutilo went obsolete with Zotero 7. (Please let me know if this is untrue.) Has someone else created a utility to batch repair the broken paths to linked attachments? It's a pretty important thing to be able to do.

Also, it would be very helpful to have a utility to report all broken paths to linked attachments.

If we could have a utility that both reports the breaks and offers to fix them in batches--all the better.

Is there such a thing?
  • Zotero will automatically offer to reassociate linked files if you set a linked attachment base directory properly.
  • Zutilo works in Zotero v7.
    https://github.com/wshanks/Zutilo

    This plugin can scan for missing attachments.
    https://github.com/SciImage/zotero-attachment-scanner
  • Thanks, Dan, but these attachments were linked before I knew what the base directory was--so they're not findable. And thanks, tim820! Glad to know this. There's hope.
  • No, Zotero can detect and relink file attachments whether or not they were set up with a linked attachment base directory.
  • edited 2 days ago
    If the links are spread all over your computer, fixing the broken links will probably be tedious. On the other hand, if they were all in one folder (or one tree), and are now in another, simply moving them in your OS to where Zotero thinks they should be would fix things. And then you could either leave them there, or move them anywhere else you wanted, using Zotmoov's right click 'move' option for example. But a linked file must first be locate-able by Zotero/Zotmoov on disk in order for it to be move-able.

    OTOH Zutilo's Modify Attachment Paths does a search and replace in the database on the paths of the selected items, which AFAIK does not require the file(s) to be located on disk first.

    If you do not currently have a Linked Attachment Base Directory set on any synced computer, then each file's linked path will be explicitly stored in the Zotero database as the exact, full path to the file at the time it was added to Zotero. Once you add a LABD, that path is modified in the database with a prefix of "attachments:" in place of the explicit path (that will be shown too when you use Zutilo's Show Attachment Paths). That prefix tells Zotero to insert the LABD in place of the prefix when trying to open the file (the LABD only affects where Zotero *looks* for attachment files; it has no effect on where they get stored).
  • edited 2 days ago
    On the other hand, it they were all in one folder (or one tree), and are now in another, simply moving them in your OS to where Zotero thinks they should be would fix things.
    You don't need to do this (and it wouldn't necessarily be possible on another computer). As I say, you can just set a linked attachment base directory properly using the new location and Zotero will offer to relink all files it can find within that base directory. We implemented this several years ago specifically to help people who hadn't set up a LABD properly and had lots of files with incorrect absolute paths.
  • I realize now it can't find them, even if it tries. I think it happened when I experimented with putting some things on OneDrive, and then later moved them again, apparently. So they aren't where they used to be. But Zutilo is helping, in cases where I was working with batches in the same folder. Thanks for your help!
Sign In or Register to comment.