Search for items which have non 'linked' files?
Apologies for asking two questions close to each other. I'm trying to identify items which have stored pdf's and not 'linked' pdfs which have been done by zotfile. Once identified I can run zotfile 'rename and move' and move to have all attachments in one location. Is there a way to formulate such an query in advanced search? Thank you
But this code run under Tools\Developer\Run Javascript will get you a list of PDF files that are in local storage (and are in the Zotero database):
var datadir = Zotero.DataDirectory.dir;
var sql = "SELECT (? || ? || key || ? || REPLACE(path,?,?)) 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(
sql,
[
datadir,
'\\storage\\',
'\\',
'storage:',
'',
'storage:%.pdf'
]
);
return filepathnames.join('\n');
The double backslashes are Windows-specific. You'd probably need to switch them to single forward slashes for Mac or Linux, but I haven't tested that.
If it's not obvious which item some of the listed PDFs belong to, you can run a Quick Search for the listed folder name (eg 9GJA3BD2), set to All Fields & Tags or to Everything.
If the list of PDFs is too long, you may be better off just doing Rename & Moves on your whole library, starting with just the A's, then the B's, etc etc.