Ryan Davis
7/19/2008 6:31:00 PM
On Jul 18, 2008, at 13:40 , Marc Heiler wrote:
> I think the docu could mention this:
>
> FileUtils.cp_r( '/Programs/ATK/Current/'+"/.", '/usr/')
there is a whole well documented paragraph of code on it (two in fact,
if you count the glob one):
> ---------------------------------------------------------
> FileUtils#cp_r
> cp_r(src, dest, options = {})
> ------------------------------------------------------------------------
> Options: preserve noop verbose dereference_root
> remove_destination
>
> Copies +src+ to +dest+. If +src+ is a directory, this method
> copies
> all its contents recursively. If +dest+ is a directory, copies
> +src+ to +dest/src+.
>
> +src+ can be a list of files.
>
> # Installing ruby library "mylib" under the site_ruby
> FileUtils.rm_r site_ruby + '/mylib', :force
> FileUtils.cp_r 'lib/', site_ruby + '/mylib'
>
> # Examples of copying several files to target directory.
> FileUtils.cp_r %w(mail.rb field.rb debug/), site_ruby + '/
> tmail'
> FileUtils.cp_r Dir.glob('*.rb'), '/home/aamine/lib/
> ruby', :noop => true,
> :verbose => true
>
> # If you want to copy all contents of a directory instead of
> the
> # directory itself, c.f. src/x -> dest/x, src/y -> dest/y,
> # use following code.
> FileUtils.cp_r 'src/.', 'dest' # cp_r('src', 'dest')
> makes src/dest,
> # but this doesn't.