#! /usr/local/bin/perl
# Perl script
# Roland Mas  1998-08-04
#
# Feel free to distribute and/or change any part of this file, but please
# give me the credits for the original idea. For instance, keep these
# copyright lines unchanged. And please charge no fee for distribution.
# Any bugfixes or suggestions are welcome, I would be glad to hear about
# your improvements. Adapt to your operating system / Perl interpreter as
# you feel like it.
# 
# Usage: modify-pov-files.pl [prefix]
# This changes all filenames to lowercase and modifies all files #include'ing
# any other one in the same directory so that the #include'd file is still
# correct, with the optional prefix (for directory).
#
# Warning: try and avoid running this script in directories with images...

$prefix = $ARGV[0] ;

print "Using prefix \'$prefix\'.\n" ;

print "Determining list of files to be scanned...\n" ;
opendir CWD, "." ;
open FILE_LIST, "> /tmp/modify-pov-files.pl-tmp-file" ;
while ($looked_for = readdir (CWD)) {
    unless ($looked_for =~ /\.new$/
            or $looked_for =~ /^\.{1,2}$/) {
        print FILE_LIST "$looked_for\n" ;
    }
}
close FILE_LIST ;
closedir CWD ;

print "Scanning files...\n" ;
open FILE_LIST1, "< /tmp/modify-pov-files.pl-tmp-file" ;
while ($looked_for = ) {
    chomp $looked_for ;
    $looked_for =~ tr/A-Z/a-z/ ;
    $replaced_by = "$prefix$looked_for" ;
    $looked_for =~ s/\./\\./g ;
    open FILE_LIST2, "< /tmp/modify-pov-files.pl-tmp-file" ;
    while ($searched = ) {
        chomp $searched ;
        unless ($searched =~ /^\.{1,2}$/) {
            $result = "$searched.tmp" ;
            $result =~ tr/A-Z/a-z/ ;
            open SEARCH, "<$searched" ;
            open RESULT, ">$result" ;
            while ($scanned_line = ) {
                $scanned_line =~ s/$looked_for/$replaced_by/ig ;
                print RESULT $scanned_line ;
            }
            close RESULT ;
            unlink $searched ;
            rename $result, $searched ;
        }
    }
    close FILE_LIST2 ;
}
close FILE_LIST1 ;

print "Renaming files...\n" ;
open FILE_LIST, "< /tmp/modify-pov-files.pl-tmp-file" ;
while ($searched = ) {
    chomp $searched ;
    unless ($searched =~ /^\.{1,2}$/) {
        $result = $searched ;
        $result =~ tr/A-Z/a-z/ ;
        rename $searched, $result ;
    }
}
close FILE_LIST ;

unlink "/tmp/modify-pov-files.pl-tmp-file" ;

    Source: geocities.com/siliconvalley/lakes/1434/download

               ( geocities.com/siliconvalley/lakes/1434)                   ( geocities.com/siliconvalley/lakes)                   ( geocities.com/siliconvalley)