How many attachments do I have?

Is it possible to determine how many attachments are in my database? I want to compare that number to the number of files in my attachment directory to help me find orphans.
  • You can get a list of attachment files (in local Zotero storage or linked files) as described here:
    https://forums.zotero.org/discussion/comment/457471/#Comment_457471
  • edited March 11, 2024
    tim820- The script in your link works well. I now have a single list of the linked attachments in the Zotero database.

    I pasted the list into LibreOffice Writer, one attachment per line, and performed a line count. I find that although my linked-file directory lists 873 items, Zotero lists 923 attachments. Most (if not all) of the non-existent Zotero attachments in the script output are the result of some attachments being listed multiple times.

    The duplicates are likely the result of my attempt to change some attachment file names. I changed names by selecting the attachment in the center pane and then clicking on the attachment file in the right pane. This brought up a "Prompt" window where I inserted the new title. ("Rename associated file" was checked.)

    HOWEVER... unbeknownst to me, Zotfile was operating. I thought that it was disabled. I tried multiple times (a bad idea) to rename some files and eventually succeeded but I theorize that these multiple tries created multiple entries in Zotero's database.

    So... is it possible to correct Zotero's database so that there are no "phantom" listings?

    UPDATE -The "Duplicate Problem" is solved by simply emptying the Trash. Now can resume cleaning up my attachment directory.
  • There is a plugin providing a solution for you:
    https://github.com/retorquere/zotero-storage-scanner

    This plugin scans your library on the background and tag them #duplicates or #broken according to their status. It doesn't work in Zotero 7 Beta and I haven't tried it with Zotero 6. If you can't make it work, try pinging emilianoeheyns in discussion, who is the author of the plugin.
  • ulahcherubim-Thanks, I didn't know about this one. It helps.
Sign In or Register to comment.