create the enclosing directory if needed
little reformatting