Forum: Ruby File.copy for 1.9

Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2009-05-09 22:00
I am a little lost as to where to find File.copy for 1.9

This worked in 1.8.6
require 'ftools'
File.copy('filename', 'dest_dir')

and in 1.9 is it this?

require 'fileutils'
File.copy_stream('filename', 'dest_name')

Did File.copy('name', 'dest_dir') disappear?
Thanks!
-=r
E7cff3cfd41c495e1012227d7dc24202?d=identicon&s=25 Luis Lavena (luislavena)
on 2009-05-09 22:30
(Received via mailing list)
On May 9, 5:00 pm, Roger Pack <rogerpack2...@gmail.com> wrote:
>
> Did File.copy('name', 'dest_dir') disappear?

ftools has been deprecated in 1.9

Use FileUtils.cp instead.
0babf177db6fc39a4460aea7b2901d08?d=identicon&s=25 Sam (Guest)
on 2009-05-09 22:49
(Received via mailing list)
Roger Pack wrote:
>
> Did File.copy('name', 'dest_dir') disappear?
> Thanks!
> -=r

require 'fileutils'
Fileutils.cp source, dest
46cf138fbe8f435d8ace342ad47ab3ae?d=identicon&s=25 Brian Buchalter (bbuchalter)
on 2011-09-08 00:09
Should be:
require 'fileutils'
FileUtils.cp source, dest  #note camel case for FileUtils

Sam wrote in post #814551:
> Roger Pack wrote:
>>
>> Did File.copy('name', 'dest_dir') disappear?
>> Thanks!
>> -=r
>
> require 'fileutils'
> Fileutils.cp source, dest
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.