Add an optional mode for mkdir

This is a back-compatible change, to be able to choose a mode for mkdir.
Merge pull request #240 from garak/patch-1

Add an optional mode for mkdir