From: Robert Klemme Date: 2009-12-15T19:09:35+09:00 Subject: Re: one-liner for lowercasing files 2009/12/14 Peter Bailey : > w_a_x_man wrote: >> On Dec 14, 12:04�pm, Peter Bailey wrote: >>> Still no good. Here's what I get: >>> >>> >ruby -e 'Dir.glob("*.*").each { |fn| File.rename(fn, fn.downcase) }' >>> >>> 'fn' is not recognized as an internal or external command, >>> operable program or batch file. >>> >>> E:\Asura-Non\BWDhelp\temp> >> >> Do not top-post. >> >> Since you are using the windoze shell, you must learn some things >> about the windoze shell.  Does that make sense? >> >> In this case, the Ruby code must be enclosed in double quotes. >> Try this. >> >> ruby -e "Dir['*'].each{|fn| p fn.downcase }" > > Here's what worked. Yours worked, waxman, but I needed a real filename > conversion, not just a print of it. > Thank you all for your help! This is great, simple stuff. > >>ruby -e "Dir.glob('*').each{|fn| File.rename(fn, fn.downcase) }" Note that if you use a directory name in Dir['*'] you need to make sure the dirname remains unchanged. Then you might rather do ruby -e 'Dir["path/*"].each {|f| d, p = File.split(f); File.rename(f, File.join(d, p.downcase))}' Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/