Hi -- On Fri, 13 Dec 2002, Travis Whitton wrote: > > how can I track/manipulate an arbitrary number of sub directories > > while tracking the location of every parent dir. I can gather a list of > > subdirectories of any current directory but i need an acurate tracking > > to make sure every directory is searched. Should I use some sort of > > stack counter or recursive function? > > I've always liked recursion. I just threw this together. Forgive me if > it doesn't work perfectly. It's a five minute throw together... > > # doesn't handle dotfiles... > def drecurse(dirname) > Dir.open(dirname) do |dir| > dir.each do |file| > if test(?d, "#{dirname}/#{file}") > next if file =~ /^\./ > puts "dir - #{dirname}/#{file}" > drecurse("#{dirname}/#{file}") > else > # Do something with file > end > end > end > end > > drecurse(".") Could you use File::Find? require 'find' File::Find.find do |file| # tests end David -- David Alan Black home: dblack / candle.superlink.net work: blackdav / shu.edu Web: http://pirate.shu.edu/~blackdav