create file and dirs before creating file