are created with Uppercase Chars but on our db server (debian stable ) mysql creates
al database files (thouse under /var/lib/mysql/exampledb ) with small chars
So i wrote 2 scripts for converting the files
#cd /var/lib/mysql/exampledb
create an script with this content
cat upercase.shrun it
#!/bin/bash
for i in *.myi *.frm *.myd
do
echo $i
mv $i `echo $i | tr "[a-z]" "[A-Z]"`
done
sh upercase.sh
then create another perl script
#vi rename.pl
with this content
#!/usr/bin/perland run it
foreach $name ( @ARGV ) {
@splitedname = split(/\./, $name);
#print "@splitedname\n";
$filename = $splitedname[0];
$extension = "frm";
$newname = "$filename.$extension";
# $newname =~ tr/A-Z/a-z/;
print "$name becomes $newname\n";
rename ($name, $newname) if ($newname ne $name );
}
#perl rename.pl *.FRM
ps: it was wrote in rush so i know it can be done better :)
::(debian)::::(mysql)::::(opencms)::::(perl)::::(bash)::
No comments:
Post a Comment