#!/bin/bash

rm -rf index.html
# Set the output file
OUTPUT="index.html"

# Start the HTML file
echo "<!DOCTYPE html>" > $OUTPUT
echo "<html lang='en'>" >> $OUTPUT
echo "<head><meta charset='UTF-8'><title>Directory Index</title></head>" >> $OUTPUT
echo "<body>" >> $OUTPUT
echo "<h2>Index of $(pwd)</h2>" >> $OUTPUT
echo "<ul>" >> $OUTPUT

a=`ls | grep -v 'index.html\|ok.sh'`
# Loop through directories and create links
for file in $a ; do
    echo "<li><a href='$file'>$file</a></li>" >> $OUTPUT
done

# Close the HTML file
echo "</ul>" >> $OUTPUT
echo "</body></html>" >> $OUTPUT

echo "Index generated: $OUTPUT"

