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.
«1
  • 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?
  • I see a beautiful future with the upcoming Manage Tags function :D
    (see also https://forums.zotero.org/discussion/78625/feature-suggestion-suggestion-for-renaming-tags#latest)
  • edited September 29, 2021
    Yes, please add a feature that allows the user to select multiple tags in the Tag Selector pane to delete. The "Delete Automatic Tags from this Library." was a big help in cleaning up my tag list. However, it would be great to also have the option to group delete tags manually added.
  • Oh my goodness, this is still not a feature. Help!
  • Actually, this tag issue could be addressed by Zutilo plugin. After installation, go to Tools - Zutilo Preference - User Interface, in the preference, you can notice the second one is Remove tags. With this, one can remove all tags for the selected items.

    As what I experienced, the proliferation of tags is mainly because of the import of RIS files for meta analysis or literature review, which downloaded from Scopus or WOS, so the tags are limited with some selected items. As such, every time, after importing RIS files, you can use this function on the imported items to eliminate attached tags.

    Zutilo plugin can be accessed by: https://github.com/wshanks/Zutilo
  • The items that added the tags to My Library have been deleted, so I cannot select them to remove tags with Zutilo. If anyone comes up with a solution that doesn't require Python experience, please post it here. It's not crucial because if I choose not to display all tags, only the ones I am using appear. But I'd still like to clean up the list.
  • @dorner: You might be misunderstanding something here. Items can be in multiple collections. Perhaps the item with the tag is still in the parent library. Or perhaps it's a tag added to an annotation? Also note that you can right-click a tag in the tag selector, which should give the option to delete the tag.

    See here:
    https://www.zotero.org/support/collections_and_tags
    https://www.zotero.org/support/collections_and_tags#tags
  • Perhaps you're looking for "Delete Automatic Tags in This Library"?
  • edited May 2, 2022
    # @altugozcelikkale 's code is working, and I will show all the python code below:

    # Note: you need to create a new private key at
    # https://www.zotero.org/settings/keys,
    # and "Allow write access".

    from pyzotero import zotero
    library_id = ' ' # your id
    library_type = 'user'
    api_key = ' ' # your key

    zot = zotero.Zotero(library_id, library_type, api_key)
    zot.key_info() # to skim user's information

    while len(tags_to_remove)>0:
    tags = zot.everything(zot.tags())
    tags_to_remove = list(set(tags))
    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))
    # Note code indentations are not shown in comments here.
  • This is recurring problem that isn't addressed through Zutilo: it's not about deleting all tags from individual items because that will also delete tags are users may wish to keep. It's simply about selecting multiple tags in a library and delete them completely in one go.
  • hsiangyu_wong: I tried this tool but the changes don't stick after syncing. It would appear that they are made locally only.
  • @SebSobecki
    This is quite strange, as this plugin doesn't take care of syncing. If it is locally changed, it should be synced by Zotero. Could you please check your Zotero syncing settings?
  • Hi, here is another approach to bulk or mass delete all tags in Zotero 7. There is no ability to delete all tags at once in Zotero. This means that tags must be deleted manually, one at a time. However, you can automate this process with the free version of Microsoft Power Automate (maybe somebody knows if there is a similar tool for mac?).

    I've uploaded a video demonstrating the process:
    https://youtu.be/tsDZ2ELw4Vw

    Install the free version of Microsoft Power Automate.

    Then:

    1. Create a new desktop flow
    2. Create a loop: "Start from: 1", "End to: 100" (to delete 100 tags), "Increment by: 1".
    3. Add the "Move mouse" action inside the loop. Choose an x and y position ("Relative to: screen") in a way that your mouse is on a tag (when you move the mouse you can see the coordinates)
    4. Add the "Send mouse click" action, and send a "Right click"
    5. Again, att the "Move mouse" action. Choose an x and y position in a way that your mouse is on "Delete Tag".
    6. Add the "Send keys" action and select from "Insert special keys" "Return".
    7. Change the time on the very bottom of the window to 3 ms.
    8. Run the action and have a coffee.
Sign In or Register to comment.