From: Peter Bailey Date: 2009-06-09T22:50:09+09:00 Subject: Re: "puts"ing an array Rob Biedenharn wrote: > On Jun 9, 2009, at 8:52 AM, Peter Bailey wrote: > >> File.open("output.txt", "w") do |file| >> Dir.chdir("L:/png/69000") >> files = Dir.glob("*.png") > Dir.glob returns an Array >> >> File.open("F:/workflows/graphics/receipts/pngfiles.txt", "w") do | >> file| >> file.puts "#{files}" >> end > The default Array#to_s is like Array#join(''). You probably want to > do either: > file.puts files.join("\n") > or iterate on the files: > files.each do |pngfilename| > file.puts pngfilename > end >> >> produces: >> 69116 >> .png69251.png69391.pngAZ69080.pngAZ69982.pngcx69362.pngcx69363.png >> . . . > > > -Rob > > Rob Biedenharn http://agileconsultingllc.com > Rob@AgileConsultingLLC.com Thank you very much, gentlemen. Yes, I did actually figure it out by simply making two loops, one for the file and one for the png files inside it. Cheers, Peter -- Posted via http://www.ruby-forum.com/.