Sajith Menon wrote:
>
> Hi
>
> I have to install a application in RedHat Linux 6.2. THe setup files are
> in a CD (burnt copy). All the files in the CD are in FULL CAPS, due to
> which setup fails. Is there any scripts or any way to change all those
> files from FULL CAPS to small.
>
> Can anybody provide me a fast solution, as I have to install this
> application very soon.
Got perl installed? If you do, then here's a script that'll do it.
----- Script starts here -----
#!/usr/bin/perl
$dir = $ARGV[0];
$case = lc($ARGV[1]);
if(($case eq "") || (($case ne "l") && ($case ne "u"))) {
print "Usage: $0 <directory (no trailing slash)> <l|u>\n";
exit(0);
}
opendir(dirname, $dir) or die("Error opening directory!");
@files = readdir(dirname);
closedir(dirname);
foreach $file (@files) {
if(($file ne ".") && ($file ne "..")) {
$lcfile = $dir."/".lc($file);
$ucfile = $dir."/".uc($file);
$file = $dir."/".$file;
if($case eq "l") {
rename($file, $lcfile) or die("Error renaming $file to $lcfile");
print "$file -----> ".$lcfile."\n";
} elsif($case eq "u") {
rename($file, $ucfile) or die("Error renaming $file to $ucfile");
print "$file -----> ".$ucfile."\n";
}
}
}
print "\nFinished!\n";
exit(1);
----- Script ends here -----
Hope this does it for you.
--
Mike Werner KA8YSD | He that is slow to believe anything and
| everything is of great understanding,
'91 GS500E | for belief in one false principle is the
Morgantown WV | beginning of all unwisdom.
PGP signature