I have a script (bleow) that I use to change the case of directory and file names of directory structures on my NT box. As it stands it changes everything to either upper or lower case, as specified on the commandline, but it would not be difficult to amend it to do one thing with directory names and another with files as it currently treats the 2 separately anyway:
#!/usr/contrib/bin/perl
##########################
# SCRIPT PURPOSE
# changes the case of all files in the selected directory structure to upper or lower case, as selected
##########################
# Define modules
use File::Find;
##########################
# Initialise variables
my @DIRS_LIST;
$dirlength = 0;
$dirname = $ARGV[0]; # read first command line switch - directory
$case = $ARGV[1]; # read second command line switch - case
##########################
# Error trap for incorrect syntax
unless ( defined($case) ) {
die "the syntax should be 'perl changecase.pl <drive:/directory> <u or l>'\n";
}
########################################
# read the directory structure
$i = 0;
chdir $dirname or die "cannot chdir to $dirname: $!"; # change to directory given by first switch
find sub { $fileinlist [ $i++ ] = $File::Find::name if -d }, '.'; # obtain list of all subdirectories
foreach my $file (@fileinlist) { # for every subdirectory found
$_ = "$file"; # write directoryname to $_
m/([a-zA-Z0-9._\s]+)[.!?]?\s*$/x; # match the name only i.e. remove path
$justname = $1; # write the name only to $justname
chdir $dirname; # change to top level directory given in commandline
if ($case eq "u" or $case eq "U"

{ # if u or U chosen
$changed = uc($justname); # change directory name to uppercase
} else {
$changed = lc($justname); # or change to lowercase
}
`rename "$file","$changed"`; # do the actual case change
$DIRS_LIST[$dirlength] = $file; # add the subdirectory name to the DIRS_LIST
$dirlength++;
}
print "\nFiles and folders in the following directories have been changed:\n\n";
foreach $directory (@DIRS_LIST) { # for each subdir in the list
my $actual = substr($directory, 2, 1000); # remove the leading ./ from the name
my $fulldir = join "/", $dirname, $actual; # produce full pathname for each subdir
print "$fulldir\n";
chdir $fulldir or die "cannot chdir to $fulldir: $!"; # change directory to next one in $fulldir
if ($case eq "u" or $case eq "U"

{ # if u or U chosen
foreach my $file (glob "*"

{ # select all files in current dir
if (!-d $file) { # if not a subdirectory
my $newfile = uc($file); # change to uppercase
`move "$file", "$newfile"`; # rename the file
}
}
} else { # if l (lowercase) selected do same using lc
foreach my $file (glob "*"

{
if (!-d $file) {
my $newfile = lc($file);
`move "$file", "$newfile"`;
}
}
}
chdir $dirname or die "cannot chdir to $dirname: $!";
}