#! /opt/gnu/bin/perl #oz: !/usr/local/bin/perl #------------------------------------------------------- # # # htmlgen - renames *.html files in a directory # to *.content, and creates a new php dynamic # .html file # #input: # file name or wildcard without the .html extension # (e.g., htmlgen index # #comments: # # - change $in to be input directory # - change title # # initialize variables # #------------------------------------------------------- my $in = $ARGV[0]; my $file = ".html"; # # define array of input files to be renamed # my @fn = glob($in.$file); my $numfiles = @fn; # # if at least 1 file is found, loop through array, # & rename files # if ($numfiles > 0) { foreach $fn (@fn) { $fn =~ /(.+).html/; $newfile = $1.".content"; rename($fn,$newfile); print $fn," renamed to ",$newfile,"\n"; open(FIL,">$fn"); print FIL < EOF close(FIL); print $fn," rewritten\n"; } } exit;