From: Stefano Crocco Date: 2007-08-23T20:29:26+09:00 Subject: Re: Renaming Files Alle gioved� 23 agosto 2007, Gabriel Dragffy ha scritto: > irb(main):043:1> File.move( f, f.gsub!( /\s/, '_' ) ) You need gsub, not gsub!. gsub! modifies the string it's called on (f), so File.move the modified string also as first argument. And, since a file with the modifed name doesn't exist, it raises an exception. Besides, gsub! will return nil if no replacement happens (i.e, if f doesn't contain spaces). This would also result in an exception. gsub, instead, creates a new string and modifies it, so File.move receives two different strings. I hope this helps Stefano