title: Filter NSFileManger contents for a list of file 'patterns' using NSPredicate
body: <p>I've an array of strings to be used as a 'filter':</p>
  
  <pre><code>@[@"*.png", @".DS_Store", @"Foobar", @".jpg"]
  </code></pre>
  
  <p>How do I use above pattern to filter out all the contents of a folder using NSPredicate?</p>
  
  <p>This is what I've got so far:</p>
  
  <pre><code>NSArray *contents = [fileManager contentsOfDirectoryAtPath:fullPath error:NULL];
  NSArray *filter = @[@"*.png", @".DS_Store", @"Foobar", @".jpg"];
  NSArray *contents = [contents filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"((pathExtension IN[cd] %@) OR (lastPathComponent IN[cd] %@)) ", filter, filter]];
  </code></pre>
  
  <p>But this doesn't give me the result that I want. For an example <code>png</code> files are not filtered. Also, I couldn't make this it case-insensitive so <code>foobar</code> is not filtered out.</p>