#! /bin/sh
# rminstalldirs -- remove directory if empty with checks 
# Author: Radu Serban

for arg in ${1+"$@"} ; do

  path=`echo "$arg" | sed -e 's,/$,,' | tr -s '/'`

  case "$path" in
      -* ) path="./$path" ;;
  esac

  if test -d "$path" ; then
    if test x"`ls -A "$path"`" = x ; then
      echo "rmdir $path"
      rmdir "$path" > /dev/null 2>&1 || errstatus=$?
    fi
  fi

done