Dotfiles

Wednesday, Nov 4, 2009, 00:35

#!/usr/bin/perl use warnings; use strict; use File::Find; use File::Spec::Functions qw(catfile no_upwards); my @dir = sort { $a =~/\.bz2\z/ <=> $b =~/\.bz2\z/ or lc $a cmp lc $b } grep { not m[ \. (?: s?html | css ) \z ]x } no_upwards do { opendir my($dh), "." or die "Couldn't open directory: $!\n"; readdir $dh; }; print join "\n", map { -e "$_.html" ? qq{<li><a href="$_.html">$_</a> (<a href="$_">plaintext</a>)</li>} : qq{<li><a href="$_">$_</a></li>} } @dir; __END__