osx 10.6.7 이상에 대한 솔루션이 필요합니다. 디스크에서 "오래된"파일을 검색하는 문제를 해결하려고합니다. 오래된 파일 나는 일찍 1 년 동안 파일을 의미합니다. 나는 자 NSPredicate 만든하지만 NSMetadataQuery이 kMDItemAccessedDates하는 대신 NSMetadataQuery를 사용하여 오래된 파일 찾기
NSPredicate * fileTypePredicate = [NSPredicate predicateWithFormat: @"file_type == \"audio\""];
NSPredicate * accessDatePredicate = [NSPredicate predicateWithFormat: @"%K <= %@", @"kMDItemAccessedDates", timeYearBefore];
return [NSCompoundPredicate andPredicateWithSubpredicates: @[fileTypePredicate, accessDatePredicate]];
아무것도
을 반환하지 않습니다 또한 나는 acess_date을 사용하지만 성공하지.
고맙습니다. 나는 문제를 미루는 것을 연기 할 필요가 있었다. 지난번부터 kMDItemLastUsedDate도 시도했습니다. 예상 된 kMDItemLastUsedDate로서 kMDItemLastUsedDate가 (2014-02-24 10:24:32) 파일의 mdls 명령의 결과를 사용했습니다. 그 경우 술어는 http://pastebin.com/PtCkPHdP이었고 결과는 0 개였습니다 : (아이디어가 있습니까?) – toohtik
@toohtik : 날짜 객체가 'date'가 아닌지 확인 하시겠습니까? –
예 I 확실 해요 .NSPredicate 인쇄 후 : kMDItemLastUsedDate == CAST (414931838.000000, "NSDate") 또한 정확한 mdls 출력 날짜를 사용했습니다. 내 자유 시간을 확인하는 경우 http : //를 참조하십시오. cl.ly/1I2C253U230b 내 osx 10.9. 고마워요! – toohtik