Create directories if needed.