Delete duplicated attachments quickly?

Hi, as you know, the attachments of Zotero are stored in directories like "/Users/Kang/Zotero/storage/2CX7K4ED/file_name.pdf". However, I have some duplicated attachments. For example, the attachment of "fancy_paper" entry in Zotero is "fancy_paper.pdf", and it is stored in "/Users/Kang/Zotero/storage/2CX7K4ED/"; while there is another "fancy_paper.pdf" in another directory like "/Users/Kang/Zotero/storage/DCXAK4HC". I don't know how that happened, maybe due to the merge of duplicated entries, or they are legacy when I move my Zotero from the previous computer to the current one. I wonder how can I find the useless duplicated attachments and deleted them?
I read some similar post like [Deleting duplicate files in Zotero storage folder in 2018](https://forums.zotero.org/discussion/73802/deleting-duplicate-files-in-zotero-storage-folder), [Zotero/Zotfile duplicates attachments? in 2019](https://forums.zotero.org/discussion/76635/zotero-zotfile-duplicates-attachments), and [Easy way to search for/clean up duplicate attachments? in 2022](https://forums.zotero.org/discussion/97592/easy-way-to-search-for-clean-up-duplicate-attachments), but there is no such a solution.
  • edited April 13, 2023
    You shouldn't really worry about the 'storage' folder — Zotero manages that for you.

    If you have duplicate attachments in Zotero itself, you can delete those items and empty the trash. There's not currently any automated way to do that, though current versions of Zotero will automatically delete identical PDFs if you merge duplicate items. But you can just click an item and press + to expand all items and scan the list for duplicates.

    The folder names you gave don't appear to be actual items in your library, so I can't tell you anything about those specifically, but you can paste them into the search bar in All Fields & Tags mode in the root of each of your libraries to see the attachments in question. Note that attachments will also appear multiple times if they're in different libraries.

    If you really do somehow have orphaned folders in the 'storage' folder, you could delete those if you were really concerned about disk space, but we don't generally recommend worrying about that, since there's the potential of deleting actual attachments by accident. A future version of Zotero will likely try to clean up orphaned files automatically.

    Generally, though, worry about what's in Zotero, not in the 'storage' folder.
  • Thanks @dstillman! You get the point - I am worrying about my disk space, because my attachments is now over 6 G, and I want to use the 6 G storage service from Zotero.
    Let's go back to my example. There is only one "fancy_paper" entry in my Zotero, but there are two "fancy_paper.pdf" in different folders in the directory folder "storage" - which means, one of them is useless at all because it is not related to any entry in Zotero. Therefore, it is safe to delete that useless folder with useless fancy_paper.pdf to save disk space.
  • edited April 13, 2023
    Folders in 'storage' that are actually orphaned don't affect your Zotero Storage usage.

    Again, you should share the actual folder names so that we can check your library. In normal usage you should never have orphaned folders, so this isn't just something you should go in and do without figuring out how it happened. You should also look at the creation dates of the folders.
  • "Folders in 'storage' that are actually orphaned don't affect your Zotero Storage usage." Thank you, I think I got the point.
    Besides, I did some calculations for the orphaned folders, the results show that the total size of the orphaned files accounts for 30% of the size of the "storage" folder. I suppose the reason for that situation is that I didn't use Zotero in an appropriate way - for example, I might have copied the Zotero folder from one computer to another computer or something.
    Anyway, I guess I can try the Zotero sync service so that my currently used entries and attachments (pdf etc.) can go to the cloud, and when I pull them again from the cloud to a new computer, everything shall be fine. Will update this post when I did that.
    @dstillman Thank you very much for your information :D
Sign In or Register to comment.