From: Simon Strandgaard Date: 2004-05-18T00:18:42+09:00 Subject: Re: How to a copy a file ? On Tue, 18 May 2004 00:08:53 +0900 "Florent 'flure' C." wrote: > Le Mon, 17 May 2004 23:53:04 +0900, Simon Strandgaard a �crit�: > > > require 'fileutils' > > # have a look at > > FileUtils.cp > > Ok, thanks :) > So I was missing something ; the FileUtils class isn't described in the > Pragmatic Programmer's Guide :( The pickaxe book is unfortunatly quite old. The RI is a commandline reference tool.. with all the goodies from pickaxe, where everything is uptodate. http://raa.ruby-lang.org/project/ri/ For instance server> ri FileUtils.cp ----------------------------------------------------------- FileUtils#cp cp(src, dest, options = {}) ------------------------------------------------------------------------ Options: preserve noop verbose Copies a file +src+ to +dest+. If +dest+ is a directory, copies +src+ to +dest/src+. If +src+ is a list of files, then +dest+ must be a directory. FileUtils.cp 'eval.c', 'eval.c.org' FileUtils.cp %w(cgi.rb complex.rb date.rb), '/usr/lib/ruby/1.6' FileUtils.cp %w(cgi.rb complex.rb date.rb), '/usr/lib/ruby/1.6', :verbose => true (also known as copy) server> -- Simon Strandgaard