benjaminoakes/maid — pull request #89 by JohnColvin (2012-12-21 19:04:21+00:00)
Title: Added filter_by_content_type

Based on the discussions at https://github.com/benjaminoakes/maid/pull/88 and https://github.com/benjaminoakes/maid/issues/51. I've added methods to retrieve spotlight content types, MIME types and interner media types.

These are used in the filter_by_content_type method. An example of this can be seen in my [maid rules file](https://github.com/JohnColvin/.maid/blob/master/rules.rb).

It also allows for multiple types in the filter. Like so:

images_and_audio = filter_by_content_type(dir('~/Downloads/*'), ['public.image', 'audio'])

This allows for easy moving of matched files:

move(filter_by_content_type(dir('~/Downloads/*'), 'image'), '~/Pictures/')