[ILUG-BOM] To small case

Rupessh Naadar rupeshn@[EMAIL-PROTECTED]
Sun Dec 29 12:24:38 IST 2002


On 28/12/02 10:54 +0530, Amish Munshi wrote:

> 	How do I convert the file names to lower case. I have a directory and the 
> files in it which are in upper case, how do i convert all of them to lower 
> case. Ofcourse except "mv UPPERCASE lowercase" since there are lots of files 
> to convert and I do not want to keep typing the lowercase file name for each 
> one of them.

#!/bin/bash

for uppercase in `ls`
do
  for lowercase in `ls $uppercase|tr [A-Z] [a-z]`
  do
     mv $uppercase $lowercase 2>/dev/null
  done
done

Hope this helps.

--Rupessh





More information about the Linuxers mailing list