use W to create directory and write file