Q:

put a output file under a folder in ruby

I'm using the line of code like below in Ruby to write log file when running a script to an output file like:
system("ruby #{file} > #{file}.out")

However, now I want to create a new folder, then expect to put the output file under this folder, I tried with the below way:
Dir::mkdir(directory_name)
system("ruby #{file} > directory_name/#{file}.out")

However, I does not observe the outfile put under folder "directory_name", anybody please guide me a way ? Thanks so much.

A:

Is directory_name a variable, in which case you should write #{directory_name} in the second line? Or is it the name of the directory, in which case you should quote it in the first line?

