How to redirect output to another directory?

(Kurt Euler) #1


The last line of the following code writes a bunch of files in the current directory (…/ruby/bin).

 content ="template1.txt").read
 fs ="fiddle.sticks").read
 IO.foreach("packages.txt") { |x|
   field = x.chop.split(':')
   content2 = content
   content2.gsub!(/<release_num>/, fs)[0],"w+").write(content2)

Question: How can I redirect the output to the subdirectory “…/ruby/bin/output”?

I would have thought that I could rewrite the last line thus:[0],"w+").write("./output/" << content2)

But this has no effect on the output.


-Kurt Euler