adding option --output_dir to output all files to a specified directory

It'd be good to be able to decide where to output the files.  If the user specifies the option --output_dir the directory is created if it doesnt exist and files are output to that.  Otherwise, behavior is unchanged.