-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.
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.
mdfind
kMDItemPath
grep -v