ensuring directory exists before shoving a file into it