here=$(pwd) 
for dire in $(tree -dfi | grep "^\.") 
  do 
    cd $dire 
    if [[ . -nt index.html ]]
    then
      echo "Updating $dire"
      if [[ -e index.html ]] 
      then
        rm index.html
      fi
      tree -H . -L 1 -F --dirsfirst -C  -D -s -T "Index of $dire" | \
         sed -e s/'<br>'/'<br>$'/g |  tr "$" "\n" | tr -d "|[]\`" | sed -e s/" -- "//g > zzzzzz_index2.html 
      grep -v zzzzzz_index2.html zzzzzz_index2.html > index.html 
      rm zzzzzz_index2.html 
      sed -e s%'<a class="DIR"'%'<IMG SRC="/icons/folder.gif">  <a class="DIR"'%g index.html > index2.html
      rm index.html
      sed -e s%'<p><a class="NORM" href=".">.</a>'%'<p><IMG SRC="/icons/back.gif">            <a class="DIR" href="../">Parent directory</a>'%g index2.html > index.html
      rm index2.html
      sed -e s%'<a class="NORM"'%'<IMG SRC="/icons/text.gif">  <a class="NORM"'%g index.html > index2.html
      mv  index2.html  index.html
    else
      echo "No news in $dire"
    fi
    cd $here  
  done
