Ways to detect and delete unassociated pdf's in my storage folder?

Sorry for asking questions too frequently for a couple of days.

Let me explain my situation before asking one more question.

I've been occasionally using Zotero to bookmark interesting papers and grab an associated pdf file(s). I used the linked attachment option to store and sync my pdf's with Google drive, but the problem was that I've been using different base directories for my home and school computers. This completely messed up my Zotero library and I had to see 'no attachment file found' message from both computers.

So I just deleted whole items from the library, gathered scattered pdf's into a single folder and imported them again into my empty library. This took some time but worked fairly well. I removed duplicate and non-source items with the aid of the storage scanner plugin as a final step.

But the problem is that the 'original' duplicate or broken pdf's are still present in my storage folder. It would be a really tough job to pick several hundred duplicate/broken pdf's out of >3000 files. How can I find out and delete items 'unassociated' with Zotero?

No forum articles or documentation regarding this problem could be found as far as I've searched. I will also need this feature for future purpose because I often replace pdf attachments of 'early view' articles with published ones. Or perhaps I might've gone through the problem without doing dumb whole-new-start things if I could find out what pdf's were not present as an item in my library...

Appolgies for meaningless long post... To make a long story short,
1. Are there ways to detect and delete 'unassociated(with Zotero)' pdf's in my storage folder?
2. Or handle attachment files directly in the standalone Zotero while using linked attachment option?
  • When you say "storage" folder -- you're referring to a folder somewhere on your harddisk where you store your linked Zotero attachments, not the folder named "storage" in the Zotero data directory?
  • I mean the former. I store pdf's in my local Gdrive folder in my hard disk.
  • I don't think there's any reasonable way to detect "orphaned" PDFs in such a folder, I'm afraid, nor can Zotero manage linked files (e.g. delete them as you delete items in Zotero).
  • That's sad:-p
    Thank you for your help anyway.
  • Could you use Zotfile to temporarily move the linked files to another folder, and then whatever is left behind are the unattached/unlinked files?
  • @gurdas Wow that's ingeneous! I'll try later and let you know the result. Thank you!
  • As an implementation of the idea from @Gurdas_Sandhu.

    1. Uncheck "Sync automatically" in Zotero preferences and close the application.
    2. Create two copies of your Zotero data folder with "-Backup" and "-Full" suffixes.
    3. Open the Zotero application, select all items in your library, move to trash, empty the trash and close the application.
    4. Using any folder/file comparison tool, compare subfolders of the "Storage" subfolder of the current data folder with that of the "-Full" suffix data folder.
    5. Delete all sub-folders from the "-Full" suffix data folder that exist on both sides. Then, exit the folder/file comparison tool.
    6. Delete the current Zotero data folder and remove the "-Full" suffix from the copy data folder.
    7. Now, open the Zotero application.

    If you are satisfied with the results then

    8. Enable "Sync automatically."
    9. Delete the "-Backup" data folder.

    You are all done!

    If something went wrong or you are not satisfied then

    10. Close the application, delete the newly renamed data folder and remove the "-Backup" suffix from the other copy.

    You are back.
  • I tried the above method by @researchfezan but couldn't get it to work. Here are the concrete steps I did to fix it with ZotFile:

    1. Back up Zotero storage folder, disable automatic sync
    2. Open ZotFile preferences, set Location of Files > Custom Location to /keep
    3. Select all references, do Right-click > Manage Attachments > Rename and Move. This will move all associated attachments from the storage folder into /keep and leave the unassociated files in the old folder.
    4. Using the file browser, select all files in path/to/storage, move to trash
    5. Set Location of Files > Custom Location to its original value,
    6. Select all references and do Rename and Move again. This will move all attachments back to the original storage folder.
    7. Turn on automatic sync, good to go

    Hope it helps
Sign In or Register to comment.