RE: [Off Topic] Directory Listing to HTML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 >  
> Anyone have a good script to generate an HTML file for a directory
> listing?
> 

I use this to generate an index.html for the cartoons I have
in a directory.  It works in the current directory and generates
an index.html file with links to all the other files.

---------------------- start ------------------------------
#!/bin/bash
#set -xv

dir=`/bin/pwd`


if [ -f index.html ]
then
   echo "remove index.html from directory $dir manually"
   exit 1
fi

dir=`basename $dir`
tmpfile=/tmp/bi$$
find . -type f -print | sed -e 's!^\./!!' -e 's! !%20!g' | sort  >
$tmpfile

echo "<html>" > index.html
echo "<head>" >> index.html
echo "<title>$dir</title>" >> index.html
echo "<META NAME="GENERATOR" CONTENT="build_index.html.sh">" >>
index.html
echo "</head>" >> index.html
echo "<body>" >> index.html
echo "<h1>$dir</h1>" >> index.html


for i in `cat $tmpfile`
do
j=`echo "$i" | sed -e 's!%20! !g'`
echo "<br><a href=\"$i\">$j</a>" >> index.html
done

rm $tmpfile

echo "</body>" >> index.html
echo "</html>" >> index.html

------------------------end  ------------------------------

Bob S
Phoenix, AZ

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux