Create RULE to delete all tags with length = 36 - HowTo?

I’m trying to get rid of a bunch (> 150K) of tags that have been auto-created upon addition through following RSS posts.

Trying to follow this interestingly similar post by fellow denizens of these forums :wink:

I found that the added tags are all 36 characters long. (pasted a couple in gsheet and applied formula =LEN(cell address))
Hence I thought the easiest way was to remove all tags with length = 36.

I then set out to create a rule to try to achieve this.
I’ve tried a couple of different settings at “Perform the following actions:”

  • On Demand
  • On Startup
    However nothing seems to happen, so my question is “What am i doing wrong?”

Then the next step / issue:
I have my DB’s synced over a couple of macs.
To start with I have disabled sync for this particular DB.
Am I correct in following reasoning:

  • first fix rule to get rid of excessive tags
  • apply rule to delete tags
  • then, on syncstore, delete the related DB (and later do the same on all macs syncing this DB)
  • once tag issue is solved, re-enable sync, uploading from the curated DB
  • on other macs, re-enable sync and download from syncstore

Thanks for helping out!

FYI: What also happened previously is that all these 36 char tags were synced as "Finder"tags…
This resulted in bringing my 2013 Mac Pro with 12 core cpu and 64 GB of ram to its knee’s…
I had to manually remove all thes thousands and thousands of tags.
Then I applied the hidden preference to disable Devonthink sync of tags to “Finder tags”


Here is a small teaching edition script that will remove tags of 36 characters from the current database…

tell application id "DNtp"
	set currentDB to current database -- Process only the current database
	set allTags to (every parent of currentDB whose (tag type is ordinary tag)) -- Get only ordinary tags
	repeat with thisTag in allTags -- Loop through the list of tags
		if (count (name of thisTag as string)) = 36 then -- Check the length and only process those that match
			move record thisTag to trash group of currentDB -- Put the tag group into the database's Trash
		end if
	end repeat
end tell

You will still need to empty the database’s Trash afterwards.

Thanks a ton Jim! Will report back,
When manually deleting I need to empty the Trash too so that’s the same…

Oops! Apparently this post was not posted yet… So, late to the show, but this has worked a ton! Thx!

Now find a way to add this to com.devon-technologies.think3?
And then sync it to other mac’s.

Glad it worked for you.

Now find a way to add this to com.devon-technologies.think3?

I’m not sure what you mean here.


Due to trying to get old hardware to work back again, I forgot all about this pitfall and stumbled back in… unfortunately

So here are a couple of thoughts / questions anno Thursday 4 August 2022:

    1. The same script does not seem to work anymore today? I get an error: AppleEvent timed out
      What I do at the moment, is have the script open in Script Editor and then manually run it (by pressing the “play” button)
      What am I doing wrong?
      What does it take to get this script back to working?
  1. Are there any scripts available to achieve the same, but not within DTPO but in the Finder?
    The way I realized what was wrong and that triggered my memory, is that
    a) the mac gets really slow and sluggish
    b) Activity Monitor shows openAndSavePanelService related various applications
    At the moment I need to do this by opening Finder Preferences > Tags pane, then using manually shift/cmd select all the wrong tags and delete them…

Thanks for helping out!

I don’t know of any such scripts. My best bet would be the find command in a terminal. But I don’t know if Apple’s version of it supports filtering by extended attributes.

Perhaps a spotlight search could help. Spotlight does permit to search for meta data, but I don’t that you can limit the search for tags with a certain length.

Hi, thanks for your reply.
I found jdberry / tag on github that seems maybe helpfull.
But I could not easily understand how to search / define “number of characters = 36”

I’m also searching the Automators forum.
Will update if I find anything.