ensure base and parent dirs