What happened to File.copy?

Did File.copy and File.cp disappear sometime between Ruby 1.6 and 1.8?
Is there an alternative in 1.8?

Ron

Ron Coutts wrote:

Did File.copy and File.cp disappear sometime between Ruby 1.6 and 1.8?
Is there an alternative in 1.8?

#copy is not in the core, it’s in the ftools library.

Hal

require ‘fileutils’
FileUtils.cp(source, dest)

-Mark

···

On Fri, Dec 19, 2003 at 07:48:59AM +0900, Ron Coutts wrote:

Did File.copy and File.cp disappear sometime between Ruby 1.6 and 1.8?
Is there an alternative in 1.8?

require ‘ftools’

Ron Coutts wrote:

···

Did File.copy and File.cp disappear sometime between Ruby 1.6 and 1.8?
Is there an alternative in 1.8?

Ron

Try to require ‘fileutils’ and use FileUtils.cp or FileUtils.copy
instead.

···

On Thu, 2003-12-18 at 23:48, Ron Coutts wrote:

Did File.copy and File.cp disappear sometime between Ruby 1.6 and 1.8?
Is there an alternative in 1.8?


o=lambda{|o|p o};O=Struct.new(:a,:b,:c);e=%q((?h,(?h,(?\ ,(?s,(?u,(74)),
(?t)),(?t,(?o,(?n,(?a))))),(82,(?r,(?e),(32)),(32,(98,(?u),(?y)))
)),
(?r,(99,(97),(?k,nil,(?e))),_(10))));def _(*a)O.new(*a)end;class O;def
e(&o)b&&b.e(&o);o[a];c&&c.e(&o)end;end;def p(o)print(‘’<<o)end;eval(e).e(&o)

#copy is not in the core, it’s in the ftools library.

Thanks all. Rookie question… :slight_smile:

Ron

AFAIK ftools.rb is obsolete now, it’s mentioned on the “old” list here:

···

On Thu, 2003-12-18 at 23:56, Hal Fulton wrote:

#copy is not in the core, it’s in the ftools library.

Hal


o=lambda{|o|p o};O=Struct.new(:a,:b,:c);e=%q((?h,(?h,(?\ ,(?s,(?u,(74)),
(?t)),(?t,(?o,(?n,(?a))))),(82,(?r,(?e),(32)),(32,(98,(?u),(?y)))
)),
(?r,(99,(97),(?k,nil,(?e))),_(10))));def _(*a)O.new(*a)end;class O;def
e(&o)b&&b.e(&o);o[a];c&&c.e(&o)end;end;def p(o)print(‘’<<o)end;eval(e).e(&o)

Florian Frank wrote:

···

On Thu, 2003-12-18 at 23:56, Hal Fulton wrote:

#copy is not in the core, it’s in the ftools library.

Hal

AFAIK ftools.rb is obsolete now, it’s mentioned on the “old” list here:

http://www.rubygarden.org/ruby?RubyLibraryCleanup/WhichLibrariesAreOld

Thanks. I think I liked it better the other way.
Doesn’t really matter.

Hal