Re: Questions about copying using FileUtils

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?” :slight_smile:


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 :wink:

psfiles.each do |psfile|

puts psfile

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


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


kind regards -botp

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