Recursively getting files

require ‘find’

dir = ARGV.shift || ‘/tmp’
files =

Find.find (dir) do |e|
FileTest.file? e and files << e
end

p files

-a

···

On Sun, 26 Jan 2003, William Steidtmann wrote:

require ‘rubyist’

Include Ponder

if cleanerWay.exists? then
cleanerWay.suggest
else
rubyist.enjoy
end

-------------------------

def DrillDownGetFiles(baseDir)
files =

Dir.new(baseDir).each {|anEntry|
next if [“.”, “…”].include?(anEntry)

fullPath = baseDir + File::SEPARATOR + anEntry

if File.directory?(fullPath) then
  files += DrillDownGetFiles(fullPath)
else
  files << anEntry
end

}

return files
end

====================================

Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ahoward@fsl.noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
====================================