From: Li Chen Date: 2006-11-27T06:29:29+09:00 Subject: Difference between using irb and window promt Hi all, I just write a script to change the filenames within a folder. Out of curiosity I want to see the differences bewteen using irb and window promt. I run the script from the window promt and I get what I want. But when I paste all the codes to irb and run from there I get error messages. In theory there is no defference using either irb or running from window promt. Can anyone there explain it? Thanks, Li I run the same script from irb first, then run it from window promt #########using irb C:\>irb irb(main):001:0> path='C:\Ruby\self' => "C:\\Ruby\\self" irb(main):002:0> irb(main):003:0* Dir.entries(path).each do |filename| irb(main):004:1* irb(main):005:1* if filename=~/(LIPID5-2)(\.\w+)/i irb(main):006:2> irb(main):007:2* open(filename).each{|line| puts line}.close irb(main):008:2> irb(main):009:2* new_name=filename.gsub(/LIPID5-2/,'LIPID5-3') irb(main):010:2> File.rename( filename,new_name) irb(main):011:2> irb(main):012:2* end irb(main):013:1> irb(main):014:1* irb(main):015:1* end Errno::ENOENT: No such file or directory - LIPID5-2.001 from (irb):7:in `initialize' from (irb):7:in `open' from (irb):7 from (irb):3:in `each' from (irb):3 ######running from window promt >ruby dir10.rb >1 20.0, 1433.33333333333, 2027.0 >2 10.0, 2223.36081942031, 3440.9456549036 >Exit code: 0 -- Posted via http://www.ruby-forum.com/.