check if the output dir exists and create it if needed