I'm looking for solutions to filter an array before a second treatment, which could be applied without further tests.
Say I want to delete all files greater than 500K from a given folder. I could:
1) get an enumerator, then for every item, test the size and remove big files; 2) get an enumerator, filter it, then remove all remaining files.
I'd like to know how to implement the solution 2. I'm thinking about another treatment (no deletion this time), like image reducing, which could be applied several times. At each loop, file sizes decrease, and the enumerator become always smaller, until it is empty. At this moment, the treatment is over.
But how to do this? I have seen numerous examples of predicates like @"SELF contains[c] 'e'"(with small variations) but never a SELF.size > 500000…
I suppose that the solution could be a block, but I have to confess that I'm completely lost...
A helping hand, please!