It's not six lines, but here is a bare bones perl script to convert 
upper case file names to lower case. It looks for gif or jpg (upper, 
lower, or mixed) or htm, shtml, shtm, or html. For simplicity I've only 
replaced names in one file (after saving the orginal as a backup.) If 
anyone needs to code to traverse a directory and subdirectories, let me 
know.

#!/usr/bin/perl

$InputFile = "abc.htm";
$Backup = "abc.bak";
rename($InputFile,$Backup);
open(INFILE,"$Backup");
open(OUTFILE,">$InputFile");
while (<INFILE>) {
  if (/(\w*\.[g|j][i|p][f|g])/i) { # is it a .gif or .jpg?
    $_ = &Translate($1);           # is so, translate to lower case
  } elsif (/(\w*\.s?html?)/i) {    # is it a htm, shtm, shtml, or html?
    $_ = &Translate($1);           # is so, translate to lower case
  }
print OUTFILE "$_"; # Write current line to output file
} # End of while (<INFILE>)

sub Translate {
  local ($String) = $_[0];
  $String =~ tr/A-Z/a-z/;
  return "$`$String$'"; # $` preceeds match, $' follows match
} # End of subroutine Translate


Urb, [EMAIL PROTECTED]

Visit America's Town Square. Creators of extraordinary Web sites.
http://www.usats.com   Build your own Home Page without knowing
any HTML. Many user selectable options. After creation, your page 
is e-mailed to you. http://usats.com/homepage

____________________________________________________________________
--------------------------------------------------------------------
 Join The Web Consultants Association :  Register on our web site Now
Web Consultants Web Site : http://just4u.com/webconsultants
If you lose the instructions All subscription/unsubscribing can be done
directly from our website for all our lists.
---------------------------------------------------------------------

Reply via email to