Ed Sinjiashvili <edsin / swes.saren.ru> wrote in message news:<wkwv2vhcnv.fsf_-_ / swes.saren.ru>...
> Hi,
> 
> I've created a little script that recurses through directories and yields
> all files to block. Here it is
> 
> class Dir
>   def walk (prefix = nil, &walker)
>     e = self.entries
>     e.delete "."; e.delete ".."
> 
>     if prefix
>       e.collect! {|x| File.join(prefix, x) }
>     end
>        
>     if block_given?
>       e.each {|x| 
> 	if File.directory? x then
> 	  Dir.new(x).walk x, &walker
> 	end
> 	yield x
>       }
>     end
> 
>     nil
>   end
> end
> 
> Dir.new(".").walk {|p| puts p}
> 

I have a very similar function, but I was wondering if this recursive
drop down and then back up through yield statements a good way of
doing things? Or is there a better way of returning a block up through
arbitary levels of recursion?

regards

steve