Here’s an easy way change the names of all files in a directory from upper to lower case (note that we are using ls -1 and not ls -l in this example):

user@server:~/test$ ls -1
FIVE
FOUR
ONE
THREE
TWO

user@server:~/test$ for file in `ls -1` ; do 
newfile=`echo $file | tr .A-Z. .a-z.` ; 
mv $file $newfile ; 
done

user@server:~/test$ ls -1
five
four
one
three
two

To invert the process, simply change reverse the options passed to the ‘tr’ command like this:

user@server:~/test$ ls -1
five
four
one
three
two

user@server:~/test$ for file in `ls -1` ; do 
newfile=`echo $file | tr .a-z. .A-Z.` ; 
mv $file $newfile ; 
done

user@server:~/test$ ls -1
FIVE
FOUR
ONE
THREE
TWO