How to a copy a file?

require ‘fileutils’

have a look at

FileUtils.cp

Ok, thanks :slight_smile:
So I was missing something ; the FileUtils class isn’t described in
the
Pragmatic Programmer’s Guide :frowning:

No, but it does describe a class called File in the Standard Library
section

docs:

copy ref.copy( fromName, toName, verbose=false ) → true or false

Equivalent to calling File.syscopy , but logs the attempt to $stderr if
verbose is not false

an example:

irb(main):001:0> require ‘ftools’
=> true
irb(main):002:0> File.copy(‘test.c’, ‘test.h’, true)
test.c → test.h
=> true
irb(main):003:0> quit