bash getopts multiple arguments or default value
After your getopts, try this
if [ -z "$directory" ]; then directory="directory"; fi
-z means if the variable $directory is null or empty. Then if user doesnt enter an argument for -d, then the script will default to directory="/whatever/files/"
At least if I understand your question correctly, this should give you a default value for -d if a value is not entered.