# How to change all Upper-case filenames to lower-case?



## lucky7456969 (Sep 10, 2012)

Like 
HELP.C FIND.C => help.c find.c
Sorry this is a general unix question.
Thanks in advance
Jack


----------



## SirDice (Sep 10, 2012)

Use tr(1)


```
upper="THIS IS UPPERCASE"
lc=`echo $upper | tr '[A-Z]' '[a-z]'`
echo $lc
```


----------



## mamalos (Sep 10, 2012)

What - I think- SirDice means is to use tr(1) in a script that will list files in your folders (using ls(1)) and change their uppercase letters to their corresponding lowercase ones (using mv(1)).

The listing part is quite easy, you can do it by using the following syntax, for example:

`$ for file in `ls /path/to/folder`; do blabla; done`


----------



## bkouhi (Sep 15, 2012)

Hi lucky7456969,

I wrote a simple script to do this:


```
#!/bin/sh

for OLD in $1/* ; do
        NEW=`echo "$OLD" | tr '[A-Z]' '[a-z]'`
        if [ "$OLD" != "$NEW" ] ; then
                mv      "$OLD"  "$NEW"
        fi
done
exit 0
```

You can use it in this way:
`/path/to/script /path/to/dir`


----------

