#!/bin/bash

printf "<!DOCTYPE html>\n<html lang=\"fr-FR\">\n<body>\n" > $2
printf "<h1>"$(readlink -f $1)"</h1>\n" >> $2	
printf "<table>\n<thead>\n<tr>\n<th>Nom du fichier</th>\n<th>Droits</th>\n<th>Taille</th>\n</tr>\n</thead>" >> $2
for file in $(ls $1)
do
	stat $file --format="<tr><td>%n</td><td>%A</td><td>%s</td></tr>" >> $2
done

printf "</table>\n</body>\n</html>" >> $2