From: "Bashar A. Asad" Date: 2001-12-22T08:47:17+09:00 Subject: [ruby-talk:29271] Re: upper case to lower okey, what if I only want to change Xblabla_Yblabla.bla the X and Y from upper to lower? thanks guys On Saturday 22 December 2001 02:33, you wrote: > Hi -- > > On Sat, 22 Dec 2001, Joseph McDonald wrote: > > BAA> am trying to write a script that will read in all the file > > names in dir X > > BAA> and convert the upper case letters to lower case. How can do > > such thing in > > > > > > Perhaps better ways, but this works for me: > > > > dir = "." > > Dir.foreach(dir) {|filename| > > newname = filename.tr('A-Z','a-z') > > File.rename(filename, newname) if newname != filename > > } > > Don't forget String#downcase :-) > > > David