Okay I can see the handiness of some little reusable function like this but why not just go one tiny step further and have it take arguments for setting the owner, group and permission. Sometimes these aren't the same as the running process sometimes the default you umask isn't what you want either.