#!perl # Vars $date = localtime(time); # Website Directory (absolute path, no trailing \) $webdir="F:\\Data\\MyWebsite"; print "*** AutoFooter @ $date ON $webdir\n"; # Start Log open(LOG,">C:\\autofoot.log") || die "Couldn't open logfile: $!\n"; print LOG "*** AutoFooter @ $date ON $webdir\n"; # Get Root $slashes=1; while($webdir=~/\\/g) {$slashes++;} # Get Files print "*** Getting File list...\n"; chdir($webdir); $dirl=`DIR *.html /S/B`; @files=split(/\n/,$dirl); # Foot Files print "*** Running Footer...\n"; foreach $file (@files) { print LOG "File: $file - "; open(FILE,"$file") || die "Couldn't open $file for input: $!\n"; @lines=; close(FILE); $foot=0; foreach $_ (@lines) {$foot=1 if /AUTOFOOTER/;} if($foot) { &getpath; print LOG "Applying \"$path\"\n"; open(FILE,">$file") || die "Couldn't open $file for output: $!\n"; foreach $_ (@lines) { if(/AUTOFOOTER/) { &dofoot; last; } elsif(/^\$/) { print FILE "\n"; } elsif(/^\$/) { print FILE "\n"; } else { print FILE $_; } } close(FILE); } else { print LOG "Skipped\n"; } } print LOG "*** Done\n"; close(LOG); print "*** Done\n"; # ----- GETPATH ----- sub getpath { $cnt=-$slashes; while($file=~/\\/g) {$cnt++;} $path = '../' x $cnt; } # ----- DOFOOT ------ sub dofoot { $f1=$path."pics/totop.gif"; $f2=$path."pics/logo.gif"; $f3=$path."email.html"; $f4=$path."search.html"; print FILE <<"(END FOOT)";
^^ To Top ^^

Logo Copyright © 1998 Hauke Daempfling
Last Updated
[ Site Search ] [ Site Map ] [ EMail ]
(END FOOT) }