Annotations deleted after using ZotFile

This discussion was created from comments split from: Zotera Beta App - PDF annotations missing.
  • edited October 15, 2021
    I have run into the same problem - but due to my own mistake.

    I had (copiously) annotated three articles using the new PDF reader and then, quite foolishly, chose to "rename attachments" using Zotfile, to convert them into linked attachments (earlier they were stored files).

    And now I notice that the annotations are gone. Probably because the storage folder in which the PDF were originally present were removed when Zotfile executed the "move" operation.

    But since the annotations themselves are stored in the DB, would like to know if there is anyway to retrieve them?

    I remember a few words that I had used in the annotations, but I had not tagged them.

    Is it possible to take a "text dump" of all annotations?

    I will be happy even if I just get the "comments" back - without the highlights to which they were linked.
  • It's not really about the file location — it's just that ZotFile deletes the old stored-file attachment and creates a new linked-file one, and in the process it deletes the annotations stored with the old attachment.

    It's likely possible to get the annotations back from one of the automatic backups in your Zotero data directory, though doing it through Zotero is a bit complicated, because you can't view the annotations without the files, and the files no longer exist in the same location. Possible, but it would be a bit tricky to do.

    If you're OK with just the comments, one option might be to use an SQLite database browser to open the zotero.sqlite.bak file (or zotero.sqlite.1.bak, depending on the timestamp) and extract the 'comment' field from the itemAnnotations table to a CSV file.
  • (If you're using macOS or Linux, we can also give you a simple terminal command to run to extract the comments from the backup database.)
  • edited October 16, 2021
    thanks a lot for the suggestion and tips.
    I will try the DB browser as I am running Zotero on windows.
  • Also had a bunch of annotations deleted. Is there a fix in develpment for this or should I always expect zotfile to delete my annotations?
  • I was able to retrieve all my annotations from the DB backup (comments as well as their corresponding text highlights) .

    Using the SQLite DB browser (https://sqlitebrowser.org) it was a breeze.

    Many thanks.
  • Thanks, but still a hassle and far from ideal.
  • Just to update this old thread from the Zotero 6 beta period, before Zotero 6 was released ZotFile was updated to not delete Zotero-created annotations when moving attachments, so this no longer occurs.
This discussion has been closed.