From: Ned Konz Date: 2002-06-12T14:27:05+09:00 Subject: Re: How to read files from a directory foreach? On Tuesday 11 June 2002 10:08 pm, Kurt Euler wrote: > Is there a way to use some type of foreach loop to read in each > text file in a directory, each pass returning a file name and its > contents in two separate strings, until all files have been read? Dir.new('dirname').each { |fname| if File.file? fname File.open(fname) { |file| contents = file.read # do something with contents } end } -- Ned Konz http://bike-nomad.com GPG key ID: BEEA7EFE