Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Create an index of a tree of html files for local viewing. (See related posts)

find . -name "*.html" -exec echo "<a href=\"{}\">{}</a><br/>" \; > index_list
mv index_list index_list.html
# open index_list.html


Comments on this post

elmo40 posts on Feb 16, 2009 at 22:31
How about making this a nice bash executable.

#!/bin/bash
find . -maxdepth $1 -name "*.$2" -exec echo "{}<br/>" \; > list_$2.html


Now you can enter 2 variables to make a custom page for each file type.

eg:
[~]# list_tree 2 pdf

This will create the file 'list_pdf.html' of only the pdf files in the current directory and one directory underneath.

You need to create an account or log in to post comments to this site.


Click here to browse all 6646 code snippets

Related Posts