mdfind is powerful, but can return bad results for complex searches unless you really know how to use it.
One thing that had me stumped for the past 2.5 hours was how to make a query with onlyin and multiple restrictions. Normally, for such a query, you can write it like so:
mdfind -onlyin ~/work 'kMDItemDisplayName == "*col.psd*"'If you want to have two restraints, you need to use the rounded brackets.
mdfind -onlyin ~/work '(kMDItemDisplayName == "*col.psd*" && kMDItemContentModificationDate >= $time.today(-30))'If you look at any example from smart folders, the rounded brackets go around each statement, not around the entire query!

No comments:
Post a Comment