Creating an Index File with XBM Graphics


 

If your web server doesn't allow directory browsing, here's a quick way to create an index file.


I was creating a CDROM version of a web site when I hit a problem. The CDROM I was making had a small embedded web server, but that server didn't allow directory browsing! And I didn't want the drudge work of manually creating default web pages. I wanted icons, not just a text directory listing. But I also wanted to stay in the "pure text" realm. So I rediscovered the XBM graphics format. It's plain text (which means it is easily stored in a script as a string), and it can be read by all browsers. It's black-and-white, but that was a small price to pay for not keeping a separate set of icons around.

You can either drag a folder and drop it on the script or you can associate the script as a right-click option on folders. Or yes, you can use it from the command line. You can change the name of the generated index file (it's a constant in the script), as well as define a separate folder for the icons (the default is to dump the icons in with the files). There's a dictionary in the script where you can even change what icon gets displayed for what file extension.

Sound interesting? Download the script.

Here's what a generated page looks like:

Here are the icons you'll find embedded in the script:

Like everything else I do, I tested it once or twice... That means there are probably a dozen undiscovered bugs. Let me know if you find any so I can get them corrected.
 
 

Lost? Look at the site map.

Bad links? Questions? Send me mail.

Google
Yahoo
Ask Jeeves