Allow dir resource to specify a mapper (for filename mapping)

Here is a proposal to implement a filename mapping for the dir resource, using a closure for flexibility. So simple mappings (like "move to subdirectory") are supported, as well as more complex user-defined ones.