Possible Duplicate:
How can I recursively change the case of files and folders under bash
How can I convert all file names to lowercase in a directory and its subdirectories, using a command or batch script?
Possible Duplicate:
How can I recursively change the case of files and folders under bash
How can I convert all file names to lowercase in a directory and its subdirectories, using a command or batch script?
First off, tr
can be used to translate text. tr [:upper:] [:lower:]
will translate all upper case characters from stdin into lower case in stdout. So it's just a matter of working that into your script...
for $FILE in `find . -name [whatever] -print` do mv $FILE `echo $FILE | tr [:upper:] [:lower:]` done
This is pretty ugly, and it spits out errors if the file name is already lower case. (because you try to move it onto itself) But it should do the job. Be sure to mod up whomever posts a cleaned up version.
This is mild variation to Christopher
's answer,
find . -type f > files.txt IFS=" "; for f in $(cat files.txt); do mv $f $(echo $f | tr [:upper:] [:lower:]) done
If you want to work on directories rather than files use,
find . -type d > dirs.txt
cmd
usually refers to the Windows command-prompt.