在 Objective-C 中,我设置NSMetaDataQuery
并设置setSearchScope:
查询以搜索特定用户的 Documents 文件夹。搜索有效,但不会沿目录树递归,仅在 Documents 文件夹中搜索。
我试过通配符,但没有乐趣。
这基本上是我尝试过的,除了不在 Documents 目录下搜索之外,它可以工作:
query = [[NSMetadataQuery alloc] init];
[query setSearchScopes:[NSArray arrayWithObjects:@"/Users/username/Documents/",nil]];
[query setPredicate:[NSPredicate predicateWithFormat:@"(kMDItemFSContentChangeDate >= '$time.this_week')"]];
[query startQuery];