argument parsing for scripts. Allows specifying target directory with -d