Error checking to show error when file passed as argument instead of directory