in reply to How to view all files in the directory using CGI

Which part are you having problems with - reading the directory? looping through the files? forming the correct URL from the filename? creating the html link with a template? displaying the web page?

Whether it's homework or not, if you don't try something and tell us where you are stuck, we can't help.