# Re: Questions about copying using FileUtils

**URL:** <https://www.ruby-forum.com/t/re-questions-about-copying-using-fileutils/58389>\
**Category:** Ruby\
**Created:** [April 21, 2006, 3:08am UTC](https://www.ruby-forum.com/t/re-questions-about-copying-using-fileutils/58389 "2006-04-21T03:08:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeSSSSaS\_Botp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ecd19e/32.png) [@PeSSSSaS\_Botp](https://www.ruby-forum.com/u/PeSSSSaS_Botp)\
**Post date:** [April 21, 2006, 3:08am UTC](https://www.ruby-forum.com/t/re-questions-about-copying-using-fileutils/58389/1 "2006-04-21T03:08:07Z")

</div>

Peter B. wrote last Thursday, April 20, 2006 10:42 PM:

# As a related question, do all iterators, like my “each”

# below, require an “end?”

maybe we ask first “what is a block?” 🙂

# Dir.chdir(“c:/scripts/ruby/temp”)

# require ‘fileutils’

# include FileUtils::Verbose

# psfiles = Dir.glob(’\*.ps’)

# psfiles.collect!{ |psfile| File.basename(psfile, ‘.ps’) }

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
lose this line. you do not really need it 😉

# psfiles.each do |psfile|

# puts psfile

# FileUtils.cp(“psfile”, psfile + “.pageinfo”)

```
               ^^^^^^^^^

```

lose the quotes 😉  
thus, your copy will look like sample.ps.pageinfo. I prefer this one so  
i can trace where my backups/copy came from originally (and it resolves  
duplicate basenames, too)

# end

kind regards -botp
