Extension to delete snapshots

This discussion was created from comments split from: Removing snapshots.
  • edited 18 days ago
    You could try this extension (https://github.com/redleafnew/delitemwithatt) to remove the snapshots by selecting the items with snapshots and right clicking, choosing Delete Attachment(s)-Delete Snapshot(s) Only.
  • edited 18 days ago
    @johnmy: Did you write this extension? If not, can you point the author to this thread?

    I would discourage people from using this extension in its current form. It's deleting files directly on disk, for no good reason. If someone wants to make an extension that moves snapshots to the trash, that's fine, but it shouldn't be deleting files on disk along with that. Zotero manages attachment files automatically. When the trash is emptied, the files will be deleted. Moving attachment items to the trash but then deleting the associated files directly so that they'd be missing if the items were restored from the trash makes no sense and breaks user expectations.
  • @dstillman, thanks for your kind reminder. Yes, I wrote this extension. I would like to move the attachment to trash (Windows trash or Zotero trash) before they were deleted from the disk, however I don't know which function should be used in the code, now the OS.File.remove was used. Is there a more proper function, and I would like to replace the improper one.
  • This extension was wrote to delete attachment simultaneously when a item was removed after zotfile was installed.
  • I tried this Zotero.Items.trashTx(id), however, after the zotero trash was empty, the attachment file still remains in the linked folder.
  • edited 18 days ago
    Linked files aren't deleted by Zotero when the item is deleted, so deleting the file directly might be reasonable for that, but you'd want to do that only for linked-file attachments — item.attachmentLinkMode == Zotero.Attachments.LINK_MODE_LINKED_FILE — and only if actually erasing the item, not moving it to the trash (where there's an expectation that the item can be restored to the library in its original state). And you'd want to warn the user clearly that you were going to delete the linked file, since that's not normal Zotero behavior and wouldn't be expected.

    For stored files, you should let Zotero handle it.

    Snapshots are always stored files, so deleting the file makes no sense for those.
  • thanks, I will consider to revise it.
  • @dstillman, thanks, the extension is updated as you suggest, only the linked file will be removed directly from the disk.
Sign In or Register to comment.