From: "David A. Black" Date: 2004-04-10T00:58:09+09:00 Subject: File.rename weirdness (was Re: need help with recursion) Hi -- On Sat, 10 Apr 2004, Robert Klemme wrote: > Dir[ File.join( dir, "**", "*" ) ].each do |name| > d, base = File.split name > changed = base.dup.gsub!("_", " ") and > File.rename( name, File.join( d, changed ) ) > end > > The same is possible with Find.find of course. In fact, File.find might be > more efficient if the hieararchy contains many files. Yes, actually I used Find.find in my example :-) You're right about the overzealous gsub'ing. I'm not sure how directories were supposed to be handled, but I thought I was ignoring them, which I accidentally wasn't. But here's some rename weirdness I've discovered while doing this: $ ls u_score/ u_file $ ruby -e 'File.rename("u_score/u_s", "u_score/u s")' -e:1:in `rename': No such file or directory - u_score/u_s or u_score/u s (Errno::ENOENT) from -e:1 I have to admit I have no idea why that happens or even what the error exactly means. (What's with the "or"?) David -- David A. Black dblack@wobblini.net