Looking for a way to smart rules files with no tag or no data in personal flied of data

I would like to create a smart rules for example filtering :

  • files with no tag
  • files with only 1 tag

First try if I left blank (in my mind no tag) nothing is filtered.

Any help?

I hope I do not need to use some regex or any programmation to perform such a thing? :slight_smile:

Works only for some file?

And not for other

If you want to find files without tags, use tags is not with * (and “Kind is any document” to exclude groups etc). tags is * will select everything that has a tag. And that works.

However, in your case, you’re adding a group with a tag to the smart group. And that group, apparently, contains documents without a tag. Is that what bothers you? Then you should ensure that your smart group selects only documents proper, not groups.

If you have another issue, you might get more useful help describing it instead of simply posting screenshots – those do neither convey what you want nor why what you get isn’t what you want.

1 Like

Actually item > is > tagged and item > is not > tagged exist specifically for this purpose. I learned about this from a recent post by (perhaps) Christian.

4 Likes

Hello,

Thank you for reply.

Sorry if my post was not clear. Though the name of the thread " Looking for a way to smart rules files with no tag or no data in personal flied of data" was clear enough about what I was looking for to achieve.

Anyway now it seems to work.

Next step I would like to isolate files with one tag and file with 2 tags.

regards

Thank you for this. I would not have discover by myself.
Tes 2 possibilities give the same results! (fortunately)

Now a “tag counter” would be great!

For… ?

I know it is a bit weird.

At first glance I was prone to add to much tag to files. I’ve stopped tagging then and finally find a way to do it using only 2 tags/file and a whole 30 ≠ tags
And for some reason many tags was created using folders name etc. Just need to find every tool to help me simplify this .

Now I would like to find files with more than 2 tags. Not mandatory but would help me :slight_smile:

Are you using group tags? Not nested or hierarchical tags, but group tags.

Actually I use flat tags.
I need to check what is nested and hierarchical .

My idea is to finally use the same tags between Finder <> Devonthink

Do you have File > Database Properties > Exclude Groups From Tagging enabled or disabled?

Actually File > Database Properties > Exclude Groups From Tagging is disabled.
Need to check in help files what does it means

Here is a code snippet that will create a group in the root of the current database and replicate documents having more than two tags to it.

tell application id "DNtp"
	tell current database
		set allTagged to search "item:tagged" in root of it
		if allTagged is not {} then
			set tempLocation to create location "/More than 2 tags"
			with timeout of 3000 seconds
				repeat with theRecord in allTagged
					if (count tags of theRecord) > 2 then replicate record theRecord to tempLocation
				end repeat
			end timeout
		end if
	end tell
end tell

This isolates the documents so you can remove extraneous tags on them in the replicants group. The change will affect all instances of the documents. When you’re done you can delete the replicants in the group. This will leave the other instances intact.

And I wouldn’t run this on a database using group tags, as those tags are automatically applied by inheriting their parent groups’ name.

3 Likes

Very helpful. Thank you!

You’re welcome :slight_smile:

Ty @BLUEFROG for this.

Will test probably today or tomorrow.
(I have to admit I do not know what is a snippet and how to use it, but I will fond in help file)

Make sure you’re in the database you want to check then do this…

  1. Open /Applications/Utilities/Script Editor.app.
  2. Paste the code from above.
  3. Select Script > Compile.
  4. If it compiles, press Script > Run.
1 Like

Hello,

This is by far the most powerful option I just discovered.
Thank you for this.
Moreover I can make some personnalisation

Thank you!

I’ve found a 5 tags files! Need to simplify

You’re welcome!
And remember, these are replicants not duplicates. So a change made to these documents affect their other replicant documents.

Yes, Replicants are one my favorite functionalities in DNtp!