taking an argument (directory) and basic error checking and exit values