I'm just looking for a clue... This is my search (the working one)

mdfind -onlyin /base_dir/ "kMDItemKind == '*PDF*' && kMDItemDisplayName != '*daxem*'c && kMDItemDisplayName == '*digitale*'c"

I borrowed the correct code from some answers in this and other StackExchange communities.

Though Apple documentation says something different. In fact, they place the c flag just after the comparison operator, wrapped in square brackets, like this:

kMDItemAuthors ==[c] "Steve" && kMDItemContentType == "public.audio"

Or, like they do in subsequent example, in the same page:

((kMDItemAuthors ==[c] "Daniel" || kMDItemAuthors[c] == "Steve") &&

 (kMDItemContentType == "public.audio" || kMDItemContentType == "public.video")) &&

 (kMDItemFSContentChangeDate == $time.this_week(-1))

In the second comparison expression, [c] is located just after the attribute identifier. They never show the c flag after the comparison string.

Therefore, I tried several different combinations, with and without parentesis, with and without spaces (for example):

$ mdfind -onlyin /base_dir/ "kMDItemKind == '*PDF*' && (kMDItemDisplayName[c] != '*daxem*' && kMDItemDisplayName[c] == '*digitale*')"
Failed to create query for 'kMDItemKind == '*PDF*' && (kMDItemDisplayName[c] != '*daxem*' && kMDItemDisplayName[c] == '*digitale*')'.

$ mdfind -onlyin /base_dir/ "kMDItemKind == '*PDF*' && kMDItemDisplayName[c] != '*daxem*' && kMDItemDisplayName[c] == '*digitale*'"
Failed to create query for 'kMDItemKind == '*PDF*' && kMDItemDisplayName[c] != '*daxem*' && kMDItemDisplayName[c] == '*digitale*''.

$ mdfind -onlyin /base_dir/ "kMDItemKind=='*PDF*' && kMDItemDisplayName[c]!='*daxem*' && kMDItemDisplayName[c]=='*digitale*'"
Failed to create query for 'kMDItemKind=='*PDF*' && kMDItemDisplayName[c]!='*daxem*' && kMDItemDisplayName[c]=='*digitale*''.

The version consistent with the documentation seems to be ignored and returns all the results matching PDF format.

mdfind -onlyin /base_dir/ "kMDItemKind == '*PDF*' && kMDItemDisplayName !=[c] '*daxem*' && kMDItemDisplayName ==[c] '*digitale*'"

Is out there, somewhere, any realiable documentations? Or am I missing something?



You must log in to answer this question.

Browse other questions tagged .