From: Brian Candler Date: 2009-01-27T19:51:43+09:00 Subject: Re: Help on Directory Iteration Newb Newb wrote: > folder structure would be ChatHistory has one folder like 2009-01-23 > has two folder namely test and user these two folders contain 2 files > each. You can get a list of all files and subdirectories under a subdirectory like this: Dir["ChatHistory/2009-01-23/**/*"] Note: if you are inserting a value from a parameter, you should sanitise it first. At least remove /../, although it's safest to allow only valid values like this: date = params[:date] raise "Bad date format" unless date =~ /\A\d\d\d\d-\d\d-\d\d\z/ Dir["ChatHistory/#{date}/**/*"].each do |f| ... end -- Posted via http://www.ruby-forum.com/.