Hi,
I was just trying to replace the underscores I get when using files from
my Linux-friends, but somehow my code seems to be corrupt.
The code runs fine without the recursion, so it must be something wrong
in those three lines, but I do not know what 
The “under_score.txt” is my testobject.
I am using: Ruby 1.8.0, Windows XP
Any help would be great.
greetings, BXS
This is my code:
class FileHandling
def noRecursiveUnderscore(basedirectory)
Dir::foreach(basedirectory){ |filename|
if File.stat(filename).file?
newname = filename.gsub("_", " ")
File.rename(filename, newname)
end
if File.stat(filename).directory? and filename != “.” and filename != "…"
noRecursiveUnderscore(filename)
end
}
end
end #class
testDir = FileHandling.new()
testDir.noRecursiveUnderscore(Dir.getwd)
**** This is my errormessage ****
recursivenounderscore.rb:4:in stat': No such file or directory - under_score.txt (Errno::ENOENT) from recursivenounderscore.rb:4:innoRecursiveUnderscore’
from recursivenounderscore.rb:3:in foreach' from recursivenounderscore.rb:3:innoRecursiveUnderscore’
from recursivenounderscore.rb:9:in noRecursiveUnderscore' from recursivenounderscore.rb:3:inforeach’
from recursivenounderscore.rb:3:in `noRecursiveUnderscore’
from recursivenounderscore.rb:17