From: Peter Bailey Date: 2006-04-21T00:21:01+09:00 Subject: Re: Questions about copying using FileUtils ts wrote: >>>>>> "P" == Peter Bailey writes: > > P> Dir.chdir("c:/scripts/ruby/temp") > P> require 'fileutils' > P> include FileUtils::Verbose > P> psfiles = Dir.glob('*.ps') > P> psfiles.collect!{ |psfile| File.basename(psfile, '.ps') } > P> psfiles.each do |psfile| > P> puts psfile > P> FileUtils.cp("psfile", psfile + ".pageinfo") > ^^^^^^^^ > > Why do you use " here ? ruby search the file "psfile" and not the name > given in the variable `psfile' > > Just write > > FileUtils.cp(psfile, psfile + ".pageinfo") > > P> end > > P> As a related question, do all iterators, like my "each" below, > require > P> an "end?" > > This is `do' which need an `end' > > You can write > > 1.times do |i| > puts i > end > > or > > 1.times {|i| > puts i > } > > > > Guy Decoux Thanks, Guy. I re-did that line, but get the same results. FileUtils.cp(psfile, psfile + ".pageinfo") OK. So, it's the "do" that needs the "end," not the "each." -- Posted via http://www.ruby-forum.com/.