Hello Everyone

I am hoping someone can help me. I have just started learning ruby and i
am in the process of creating a script that will rename files based on
some of the file contents. So far i have got what i want but need the
file to be renamed with a variable but cannot for the life of me find
out how to simply rename the original input file. Below is an example of
what i mean.

x = File.readlines(ARGV[0])
random code...
filename = "filetobenamed"

So now i want to rename the original input file with something like
file.name("#{filename}")

One idea i thought of was to just create a new file with the contents of
x but even that was proving more difficult than i expected.

Any ideas would be greatly appreciated?
Iv searched around for hours and tried various methods but cannot find a
solution.

Thanks :)

-- 
Posted via http://www.ruby-forum.com/.