Help copying files

Hi,
I’m tryin to have Ruby copy some files so I don’t have to :smiley:

I can make the Directories, but apparently I need FTOOLS to actually
copy some files from hither to yon.

I can’t seem to find FTOOLS…anybody know where to get it? And
then…
where do I put it so Ruby can “see & use” it.

OR…

Is there a different/better way to copy files than FTOOLS?

I’m tryin to avoid actually opening EVERY FILE and loopin thru each line
writin into the new file…but I’m not above doin that :wink:

2008/8/7 Bob M. [email protected]:

OR…

Is there a different/better way to copy files than FTOOLS?

Use FileUtils:

require "fileutils"
FileUtils.cp src, dest

ri has lots of documentation about it!

Stefan

Thanks…worked great!

Here is a bit from Matz’ book:

The copy method will copy a file to a new name or location. It has an
optional flag parameter to write error messages to standard error. The
UNIX-like name cp is an alias.

require “fileutils”

Copy epsilon to theta and log any errors.

FileUtils.copy(“epsilon”,“theta”, true)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs