Import with attachment location
I'm trying to move my bibtex collection into zotero, and I'd like to preserve attachments and collection information is I do so. I've tried converting my bibtex files into zotero RDF, which seems to be the most rich format, but it's not picking up my attachments. When I export a sample zotero rdf, I see that it stores only file names to linked attachments, not full paths (and a round-trip of Zotero RDF also loses the attachments).
Is there a way for me to get Zotero to pick up these attachments by structuring the RDF differently, or another way to get my collection/attachment info migrated, other than direct writing into the sqlite database? If only the latter, is the DB format documented?
Thanks,
Emile
Is there a way for me to get Zotero to pick up these attachments by structuring the RDF differently, or another way to get my collection/attachment info migrated, other than direct writing into the sqlite database? If only the latter, is the DB format documented?
Thanks,
Emile
- If you're trying to attach _links_ to files via RDF (or any other) import then no, that's not possible. No, the sqlite isn't documented beyond the sourcecode, I _think_ this should be doable via the local API: http://www.zotero.org/support/dev/client_coding/javascript_api , which is decently documented, but I haven't actually looked at attaching links.
- If you're just trying to import files into Zotero via RDF or BibTeX import (i.e. the equivalent of "store copy of file"), that should just work, certainly roundtrip.
Any idea what the column sourceItemID does? itemID links the attachment to the library item, so that's not it.
By the way, the only solution, I found (which was very time-consuming), is to import with absolute links and convert them to attach links with Zotfile. Works fine but not if you have many folders, as you have to do them folder by folder.
Thanks
That would effectively mean moving files in and out of Zotero, though, rather than just linking to existing ones.
Yes, Zotfile can do the change from storage to attachments in batch. But ideally, it will be better if we can directly import as a "attachment.linkMode" than "item.attachments" (from what I understood in bibtex translator.js file). That way, we circumvent the folder problem (in Zotfile preferences, you decide in which folder your file is linked in, so basically it's easy if you have one big folder and tricky if you get more)
@Dan: do I need to take this sourceItemID into account for the JS api? I still don't really understand what it is meant to do; the attachment is already bound to it's item with the itemID, right?
I've submitted a pull request to the original author of zotfile, so perhaps it will be integrated; if not, I'll split it off to a separate extension.
Thanks for this work.
does not work for me after installing the addon on standalone Zotero, unfortunately. Drag-n-dropping a PDF file on Zotero window, or importing a BibTeX file still leads to PDFs being copied (not linked) to Zotero storage dir.
Thanks for updating the script. I had silly issues getting it to work initially, but as someone perhaps does the same mistake (maybe atenrok did?) I will say here.
Being a zotero-stranger, it was easy to miss: "everything that resides in your basedir will automatically be linked instead of imported."
I merely updated my base directory to where the files are, and now everything is working perfectly with all versions.
Many thanks, this extension is amazing!
So, many thanks to Emiliano.
Jan
PS. I still feel this would be a worthy option for Zotero, and it seems to be planned. FWIW, the option might be made context-dependent: if you import references after having specified a base directory for the relative path (in the Advanced preferences tab), the import would be relative links. Otherwise, the files would get copied. This could make a dialog unneccesary.
and yes it's definitely planned. The consensus implementation is a pop-up on import. Importing with files is relatively rare so this won't annoy users (if it turns out to be a problem there could be a "remember this setting" option, but not even sure that's necessary) and since a lot of the people affected by this will be first-time users, it'd be a bad idea to hide this behind a contextual solution. The base directory is also not strictly necessary for wanting to use linked files. You only need that if you want linked files on multiple computers.