This is the simplest…
output_file = “#{input_file}_output.txt”
On the other hand, you can look at the FileUtils to see how to get the
base name or the name without extension, etc… so that you can make it
more productive. I’m just suggesting the simplest.
Am Freitag, 16. Okt 2009, 02:44:38 +0900 schrieb Collin M.:
I’m just doing a simple file.open, and couldn’t find anything.
File.open(‘output.txt’, ‘w’) do |f2|
File.readlines(“original.txt”).each do |line|
Do you get the below error message?
irb(main):001:0> File.exists? “nonexistent”
=> false
irb(main):002:0> File.read “nonexistent”
Errno::ENOENT: No such file or directory - nonexistent
from (irb):2:in `read’
from (irb):2
irb(main):003:0>
Bertram
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.