When I wrote this, I had found out about the repository papis which is pretty nice. However, when I checked out the papis-zotero repository, I realized that the repository was a bit outdated, some of its documentation was a little outdated, and it didn’t particularly do what I wanted it to do. To my understanding, the package described in papis-zotero is setup to do a single copy of the files described in the zotero.sqlite
. But the problem is that not all of the attachments are copied over, and the way the files are organized is that it saves the database keys as the names of the folders where the PDF files end up being copied to.
What I particularly wanted was a tool which allowed one to parse the information from Zotero to papis in a way that it would keep some sort of human-readable file structure, and keep the attachments used on Zotero. How I then decided to design this is to make this a one-way workflow which looks through the SQLite file from Zotero, and copies them over to the papis directory.
First clone the repository and go into the repository.
git clone https://github.com/nicolasshu/zotero2papis
To set it up, you may either use as an editable package:
pip install -e .
Or as a binary package on your environment:
python3 setup.py install
# or
pip install .
To use it, simply run
zotero2papis -z {location_of_zotero} -o {output_location}
where the -z
/ --zotdir
will be the parent directory of where your Zotero database is located (e.g. ~/Zotero
or ~/sync/zotero
) and -o
/ --outdir
will be the output directory. If the output directory does not exist, then the program will make the appropriate directories for you.
This will then start copying the files to the output directory. It will be first looking through the database to see where the files or linked files are originally located.
- If the output directory is the same directory that the PDF files are already stored, then:
- It will copy the attachments from the Zotero storage to the output directory
- It will create the YAML files in the output directory
- If the output directory is at a different location, then:
- It will copy the PDFs from the location they are originally stored to the output directory
- It will copy the attachments from the Zotero storage to the output directory
- It will create the YAML files in the output directory
At this point, you can start to use papis on the output directory or to copy the contents to your desired papis library. In case you do not see any updates on your papis despite you having changed the directory or moved the files, clear the cache by running the following as suggested in the FAQ.
papis --clear-cache