From: Dirk Traulsen Date: 2007-10-20T02:30:46+09:00 Subject: Re: How to combine blocks and recursiveness Am 18 Oct 2007 um 18:22 hat Robert Klemme geschrieben: > #!ruby > > require 'find' > require 'pp' > > ARGV.each do |dir| > list = Hash.new {|h,k| h[k] = []} > > Find.find dir do |f| For Windows it might be nicer to add f= f.gsub(/\\/,'/') so you don't have a mixture of '\' and '/' as separators. > d, b = File.split f > next if /^\.\.?$/ =~ b Find:find does not return '.' or '..' like Dir:entries does for example as Find.find is implicitely recursive. So this line can be omitted. > list[d] << b > end > > pp list > end Have fun! Dirk