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:

路路路

--
Posted via http://www.ruby-forum.com/.

Use FileUtils:

    require "fileutils"
    FileUtils.cp src, dest

ri has lots of documentation about it!

Stefan

路路路

2008/8/7 Bob Miner <bobminer@lobo.net>:

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?

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)

路路路

--
Posted via http://www.ruby-forum.com/.

Thanks....worked great!

路路路

--
Posted via http://www.ruby-forum.com/.