Zotfile setup - Find all stored (not linked) attachments

Hello! I'm using Zotero with Zotfile to manage my linked attachments, which are stored in a folder that syncs with my OneDrive.

Everything works fine whenever I add an item to Zotero through the journal webpage. However, whenever I add a PDF directly, it gets stored in Zotero storage and does not get automatically moved and renamed by Zotfile. I understand this is expected behaviour.

I can then manually moved them by right clicking an item and choosing "Rename Attachments". That also works. But in the middle of a research session, it's natural that sometimes I miss some (because it opens the pdf in the browser directly), and I get some attachments stored in Zotero Storage while others are in the folder on OneDrive.

Is there any way I can search for "Stored Files" or "Non-linked files" on Zotero so I can periodically go through them and manually run Zotfile on them?
  • Good question. I've been wondering the same kind of thing. :-)
  • Two ways I have used to find stray PDFs that haven't been moved, albeit both external to Zotero:
    (1) Use your OS's file search routine to find any PDFs under the Zotero\Storage hierarchy.
    (2) I use FreeFileSync (Windows app) for backups. It shows me all new files under Zotero\Storage since the last backup. So it's easy to see any new stray PDFs that haven't been moved yet.
  • Thanks, @timwr820. I was thinking of doing something like that. But I've instead decided to go with a saved search based on a system of tags in Zotero that'll let me know whether I've moved a given items attachments or not. Took a few tries to get it working, but it seems like it'll do the trick and help me keep track of things so I'm not looking at the same record multiple times.
  • this would be a very useful feature, seems like it should be possible to set up a search for this but it doesn't seem to be.
    I sometimes end up wanting to make sure a set of items is all on zotero storage (tricky to switch from linked to local, but that's another story), and without this it's necessary just to try moving all of them to be sure, or select one by one.
  • @tmchartrand: You can just select all items and go to Tools → Manage Attachments → Convert Linked Files to Stored Files. Any stored files that are selected will be ignored.
  • Adding to my manual method above for finding locally stored PDFs (that I have omitted to have Zotfile move to my linked storage folder), I now use the code below run in Tools\Developer\Run Javascript. It returns a list of all PDF files that are (still) under the local Zotero\storage folder hierarchy ...

    var sql = "SELECT (? || '\\storage\\' || key || REPLACE(path,'storage:','\\')) AS filepathnames FROM itemAttachments JOIN items USING (itemID) WHERE libraryID=1 AND path IS NOT NULL AND path LIKE ? ORDER BY filepathnames";
    var filepathnames = await Zotero.DB.columnQueryAsync(
    return filepathnames.join('\n');
Sign In or Register to comment.