create directory before putting a file in it