On 23-Jun-07, at 10:39 AM, Sudev Barar wrote:

> I am writing some intranet pages under ~/public_html directory. As I
> keep adding more and more pages under this directory I want to create
> a index.html page here that will constantly update itself whenever a
> new page is added and provide a link to that page.

something like this, assuming you list of links is in a file called  
filelist. Run as a cron job or manually everytime you add a file

#!/usr/bin/python

import os

f = open('/var/www/html/filelist','a')

for fle in os.listdir('/var/www/html/'):
     if os.path.splitext(fle)[1] == '.html':
         lne = """<a href = "./%s">%s</a>""" %(fle,fle)
         if lne not in f.readlines():
             f.write(lne)
f.close()



-- 
regards

Kenneth Gonsalves
Associate, NRC-FOSS
[EMAIL PROTECTED]
http://nrcfosshelpline.in/web/




_______________________________________________
ilugd mailinglist -- ilugd@lists.linux-delhi.org
http://frodo.hserus.net/mailman/listinfo/ilugd
Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi 
http://www.mail-archive.com/ilugd@lists.linux-delhi.org/

Reply via email to