Label folder based on file count

If you want a super-quick solution, you could add the File Count column and sort or group by that.

For scripting, the Opus Manual menu at the top-right here has quick links to the main things, and the Buttons/Scripts part of the forum has lots of examples. We can help as well, if you get stuck.

Here are some scripts which do similar things to what you want. You can probably adapt or use them as inspiration to save time:

This isn't a column you could use for filtering, but shows how to enumerate folder contents in a script, which the other two scripts use:

Script columns can then be used in filters and labels, to e.g. apply a label if the script-column value is "yes" or greater than 10.

We can sometimes write scripts for you if we have time; more likely if you link your account and can provide some more detail on what you need, (e.g. Do you want the count to be recursive or not? And is the aim to always check for X amount of files, or to make that something you specify in the filter? If it's always X then the script could stop looking once it reaches that number, to speed things up a bit.)