I use the tree command in a pre tag to render the directory listings, and I wrote about this here http://lornajane.net/posts/2011/the-tree-command Hope that helps!