Batch Removal of Tags

Is there a way to batch remove tags that have that have not been automatically attached to bibliographic items? This appears to be the case when items are imported from database searches. I have deleted all the tags that were attached automatically via the dropdown menu but there are still several hundred that appear when asking Zotero to display all tags in the library. I am hoping to delete every tag in the library without having to delete each one individually.
  • Click the little colored boxes icon at the bottom of the tag seekector and choose Delete Automatic Tags from this Library.

    You can disable automatic tagging of items in Zotero preferences.
  • Thank you I already did that. The question is: How do you batch edit tags that were not attached automatically?
  • You can do this using PyZotero with Python, but there‚Äôs no way in the Zotero app directly at this time.
  • OK. Nice to know. I guess I will do it the hard way. Thanks.
  • Dear Zotero Programming Gurus. PLEASE PLEASE PLEASE figure out how to allow users to select multiple tags and delete them all with one click. I've been searching for a way to do this, and see that folks have been asking for this feature since at least 2008. Thanks!!!
  • Is this feature available yet?
    Need to delete hundreds of tags that came with an RIS file I imported...thus not "automatic" tags.
    Using Zotero standalone
  • I am also looking for a solution to deleting multiple tags at once.
  • An ideal solution would be for the user to be able to select several tags at once and simply delete them all in one go. And, to have an option to not ask if the person is sure. Simply delete without confirmation.
  • Is there a way to delete tags from Zotero online?
  • How to do this using PyZotero with Python?
  • Is this item simply being ignored. Tags cause me so much trouble that I am thinking of quitting Zotero.
  • I had a similar problem and PyZotero is the only way to do it I think (at least atm). There is a function called 'Zotero.delete_tags()' which you can also pass a list to. But it only is able to delete 50 tags at once (don't know if you can change that). So what I did was first creating a list with all my tags and then make smaller subsets of this list with only 50 items which i then pass to the delete_tags function. For example:
    #create list with all tags
    all_tags = zot.everything(zot.tags())
    #create a first subset of this list
    tags_part1 = all_tags[:50]
    #delete first 50 tags
    zot.delete_tags(*tags_part1)

    I then just updated the all_tags list after each deletion and repeated the process. It is not the nicest way to do it (you could also write function for it I guess) but I just wanted to get it done.

    Hope that helps!
  • edited February 4, 2019
    paulgrassl's solution works perfectly well. Here is a small modification I made to run it in a loop, 50 or less number of tags at a time:

    ```
    while len(tags_to_remove)>0:
    tags = zot.everything(zot.tags())
    tags_to_remove = list(set(tags).difference(tags_to_keep))
    tags_to_remove_n = tags_to_remove[:min(len(tags_to_remove),50)]
    zot.delete_tags(*tags_to_remove_n)
    print('Number of Remaining Tags:',len(tags_to_remove))
    ```

    * You can use `tags_to_keep` to preserve a list of tags that you don't want to be deleted.
    ** Note code indentations are not shown in comments here.

    Example screen output:

    ```
    Number of Remaining Tags: 1052
    Number of Remaining Tags: 1002
    Number of Remaining Tags: 952
    Number of Remaining Tags: 902
    Number of Remaining Tags: 851
    Number of Remaining Tags: 801
    Number of Remaining Tags: 752
    Number of Remaining Tags: 702
    Number of Remaining Tags: 652
    Number of Remaining Tags: 601
    Number of Remaining Tags: 552
    Number of Remaining Tags: 502
    Number of Remaining Tags: 451
    Number of Remaining Tags: 402
    Number of Remaining Tags: 352
    Number of Remaining Tags: 302
    Number of Remaining Tags: 252
    Number of Remaining Tags: 202
    Number of Remaining Tags: 152
    Number of Remaining Tags: 102
    Number of Remaining Tags: 52
    Number of Remaining Tags: 2
    Number of Remaining Tags: 0
    ```
  • While it is nice to see that there is a way, for those of us without python programming knowledge (or Greek), this looks like Greek to me. I wonder if there isn't a way to package something like this within Zotero to make a seamless solution?
  • Me too like jjroper, why not update this function?
Sign In or Register to comment.