Use custom `mkdir` to create the tree if needed.