From: "SHULTZ,BARRY (HP-Israel,ex1)" Date: 2001-09-23T15:31:02+09:00 Subject: [ruby-talk:21591] Re: Problem with directory? Re: Path walk ing on windows Hi Charles, It works for me if I change if test("d?", x) to if FileTest.directory?(x) HTH, Barry > -----Original Message----- > From: Charles Hixson [mailto:charlesh@pop.newsguy.com] > Sent: Sunday, September 23, 2001 5:43 AM > To: ruby-talk@ruby-lang.org > Subject: [ruby-talk:21578] Re: Problem with directory? Re: > Path walking > on windows > > > 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| > print "Processing <<#{x}>> " > # afile = File.lstat(x) > # puts afile.inspect > # f = File.ftype(afile) > # puts f.inspect > # if f.directory? then > # if f == "directory" then > if test("d?", x) > Dir.new(x).walk x, &walker > else > puts "#{x} is not a directory." > end > yield x > } > end > > nil > end > end >