Mdfind exclude folder

-onlyin

in mdfind looking for a specific folder.
How can I exclude certain folders when combined with -onlyin?

Thus, if I want to search the entire SearchHere folder containing folders A, B and C and exclude from the search in C.

+3


source to share


1 answer


You can use something like:

mdfind -onlyin SearchHere 'kMDItemFSName==ItemToSearch' | grep -v '/C/'

      



mdfind

seems to be ignoring kMDItemPath

, so using grep -v

should fix the problem.

+1


source







All Articles