Spotlight metadata library

I don’t see why not. You can exclude any folder you like.

But you gave a very specific case, and I gave you a solution, that always works for searching for “scpt” files while excluding “scptd” packages.

You may not like it, but it is a solution for searching the Script Libraries folder, where it is unlikely that I have script libraries in sub-folders.

What is your solution for searching only for “.scpt” files in the Script Libraries folder and all sub-folders?

Now that we know the find command will treat packages as regular folders, we can use the find tool appropriately, just like any other tool. No tool is perfect, or without its limitations. It is always best to know your tools before you use them, or be prepared for a lot of test and debug.

IAC, seems to me that most likely the user will be searching for other criteria as well, like characters in the file name.

But, again, the Bash find command is but one tool in my tool kit. I’ll use it when it is the most appropriate tool for the job, including my time. I still have other tools if I need them.

I think the limitations you pointed out will seldom occur in many use cases.

Exactly. I see lots of scripts built around tools like find that fail to account for the possibility of packages being treated as folders. It’s not that there aren’t ways around the problem — it’s that people overlook the limitation in the first place.