I haven't did much with scripts before. I am still researching best ways to do it.
Here is how I was thinking I will do it, but I haven't got the script written yet:
Use the `find` command to locate every directory within the parent tree, including the top directory. Then, inside every one of the found directories, I will use `find` again (with a -maxdepth of 1) to locate all directories & html files present; then I'll create the index.html file, and insert (probably just using `echo`) a <href=link> to each directory and/or html file present within my current directory.
Thank You. And no, this is not for homework. It is for a personal web server that I set up so that I can watch all of my movies in WebM format with my laptop. I already wrote a script that finds all of the WebM files and creates a html file for each webm file so that I can view them. Now I just am figuring out how to make indexes of all of the files.
A script that searches all directories and subdirectories for .html files
find /ALL_DIRECTORIES -name "*.html" -type f -print
When a .html file is found it creates a index.html file in that folder.
find /ALL_DIRECTORIES -name "*.html" -type f -exec dirname {} \; |sort -u |while read dir
do
if [ -f "$dir"/index.html ]
then
touch "$dir"/index.html
fi
done
for rest, you need tell us what type of links you need write in the index.html files for these .html files and folders.