#!/bin/bash

SERVER=ftp.1und1.de
DIR=ein/zwei/directory
USERID=deine_ID
PASSWD=sehr_geheim

rm -f .listing index.html

wget --mirror --no-host-directories --no-directories --level=1 \
     --dont-remove-listing --reject=* ftp://$USERID:$PASSWD@$SERVER/$DIR

dos2unix .listing

echo "<HTML>"                           >  index.html
echo "<HEAD>"                           >> index.html
echo "<TITLE>Index für /$DIR</TITLE>"   >> index.html
echo "</HEAD>"                          >> index.html
echo "<BODY>"                           >> index.html
echo "<H2>Index für /$DIR</H2>"         >> index.html
echo "<HR>"                             >> index.html
echo "<PRE>"                            >> index.html

( cat .listing ; echo ) |
while read VAL
do
  LINK=`echo "$VAL" |cut -c 60- |cut -d " " -f2`
  echo "<A href=\"$LINK\">$VAL</A>"     >> index.html
done

echo "</PRE>"                           >> index.html
echo "</BODY>"                          >> index.html
echo "</HTML>"                          >> index.html
