G
Gabriel Dragffy
Hi, I'm just trying to rename a whole load of files in a directory.
Been palying with IRB. My code doesn't work, no doubt because I
fluffed it.
irb(main):041:0> Dir.entries('.').each do |f|
irb(main):042:1* next if f=="." or f==".."
irb(main):043:1> File.move( f, f.gsub!( /\s/, '_' ) )
irb(main):044:1> end
Errno::ENOENT: No such file or directory -
Animating_Reality_2pm_26th_July_2007.MP3
from /opt/local/lib/ruby/1.8/ftools.rb:106:in `stat'
from /opt/local/lib/ruby/1.8/ftools.rb:106:in `move'
from (irb):43
from (irb):41:in `each'
from (irb):41
from :0
What's the best way of doing this, please?
Regards
Gabriel
Been palying with IRB. My code doesn't work, no doubt because I
fluffed it.
irb(main):041:0> Dir.entries('.').each do |f|
irb(main):042:1* next if f=="." or f==".."
irb(main):043:1> File.move( f, f.gsub!( /\s/, '_' ) )
irb(main):044:1> end
Errno::ENOENT: No such file or directory -
Animating_Reality_2pm_26th_July_2007.MP3
from /opt/local/lib/ruby/1.8/ftools.rb:106:in `stat'
from /opt/local/lib/ruby/1.8/ftools.rb:106:in `move'
from (irb):43
from (irb):41:in `each'
from (irb):41
from :0
What's the best way of doing this, please?
Regards
Gabriel