Advertisement
priore

Get file list with NSPredicate

Nov 13th, 2012
851
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // get file list with NSPredicate
  2. NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
  3. NSFileManager *fm = [NSFileManager defaultManager];
  4. NSArray *dirContents = [fm contentsOfDirectoryAtPath:bundlePath error:nil];
  5. NSPredicate *fltr = [NSPredicate predicateWithFormat:@"self like '*.jpeg'"];
  6. NSArray *fileNames = [[dirContents filteredArrayUsingPredicate:fltr] retain];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement