shell script to check the directory exists

C++
DIR="/etc/httpd/"
if [ -d "$DIR" ]; then
  ### Take action if $DIR exists ###
  echo "Installing config files in ${DIR}..."
else
  ###  Control will jump here if $DIR does NOT exists ###
  echo "Error: ${DIR} not found. Can not continue."
  exit 1
fiDirectory="/opt"
if [ -d "$Directory" ];
then
	echo -e "it's exits\n"
fi
### To check if it's not exists
if [ ! -d "$Directory" ];
then 
	echo -e "It's not there\n"
fi
Source

Also in C++: