[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: script to convert filename to lowercase



"Darryl Röthering" wrote:
> 
> Can one of you gurus quickly help me with a script? I have a directory with
> several thousand files named inconsistently with a mix of uppercase and
> lowercase. I need to rationalize these to be named with all lowercase. I
> know you guys will have a dozen ways to do this.
> 
> Regards,
> 
> Darryl
Try this.

for file in `ls -1`; do
  lfile=$(echo $file | tr [A-Z] [a-z])
  echo ${file} ${lfile} # chg echo to mv
done

This will change directories too and doesn't work for file names with
spaces such as "My Stuff" without the quotes.

Eric



Reply to: