Make sure directory exists before attempting to place file