[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: bash script

Vani R. forced the electrons to say:
> I have around 120 files in a directory whose names are in uppercase
> letters. I want to change all these filenames to lowercase letters.

Use this cute perl one liner to convert a word to lowercase.
echo $word | perl -pe 's/(.*)/\L$1/g'

Loop over all the files in the directory, setting word to be each.
So, we have this little script :-)

for file in *; do 
   newfile=$( echo $file | perl -pe 's/(.*)/\L$1/g' )
   mv $file $newfile

And voila!


PS: Warning: Untested code!