# Help copying files

**URL:** <https://www.ruby-forum.com/t/help-copying-files/145231>\
**Category:** Ruby\
**Created:** [August 7, 2008, 12:37am UTC](https://www.ruby-forum.com/t/help-copying-files/145231 "2008-08-07T00:37:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bobm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9fc348/32.png) [@bobm](https://www.ruby-forum.com/u/bobm)\
**Post date:** [August 7, 2008, 12:37am UTC](https://www.ruby-forum.com/t/help-copying-files/145231/1 "2008-08-07T00:37:06Z")

</div>

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

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 😉

---

<div class="post-metadata">

**Author:** ![bobm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9fc348/32.png) [@bobm](https://www.ruby-forum.com/u/bobm)\
**Post date:** [August 7, 2008, 1:54am UTC](https://www.ruby-forum.com/t/help-copying-files/145231/2 "2008-08-07T01:54:54Z")

</div>

2008/8/7 Bob M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> 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

---

<div class="post-metadata">

**Author:** ![bobm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9fc348/32.png) [@bobm](https://www.ruby-forum.com/u/bobm)\
**Post date:** [August 9, 2008, 10:58pm UTC](https://www.ruby-forum.com/t/help-copying-files/145231/3 "2008-08-09T22:58:31Z")

</div>

Thanks…worked great!

---

<div class="post-metadata">

**Author:** ![bobm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9fc348/32.png) [@bobm](https://www.ruby-forum.com/u/bobm)\
**Post date:** [August 7, 2008, 5:56pm UTC](https://www.ruby-forum.com/t/help-copying-files/145231/4 "2008-08-07T17:56:56Z")

</div>

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)
