List of folders, ignore folders in UDT

I would like to get a list of tag folders, which is simple enough using system.tag.browse.
However, I don't want folders that are in UDT instances. Does anyone have a clever way to do this?

Is there a way to know that a folder is part of an instance? If you try to delete a folder in an instance, the designer will prompt you that the entire instance will be deleted, so it knows somehow, just not sure how to tell in a script.

I would think that you would need to build your own recursive browse, since I don't know of a way to set the filter options for an inversion.

You could though do your own recursive browse and only recurse if the TagType is not a UDT.

If I have a little time later, I will see if I can write up a script, though I am sure you're capable of it. Also not sure I would call this "clever".

Have you tried the new tag report tool?

Set up a query using the GUI, and it can generate the script for you. No recursion required.

I didn't see a way to return any folder in the tag report tool, so I really didn't try much harder after that.

It looks like the latest version has options for udt members and udt definitions in the tag report tool. I will upgrade and try it out.

Edit, I didn't realize it was under property. The screenshot will grab all folders and ignore UDTs.