From: Derek Smith Date: 2009-04-03T07:47:00+09:00 Subject: Re: hash with files Martin DeMello wrote: > On Fri, Apr 3, 2009 at 3:38 AM, Derek Smith > wrote: >> � � � �from test.rb:48:in `each_value' >> � � � �from test.rb:48 > > Dir.glob returns an array of matches. Could you post the code where > you're constructing the hash? > > martin Hi Martin, here it is. its also in the attachment. Dir.chdir("/cygdrive/c/temp/log") or raise StandardError, "Change dir failed to ~aevvrlog!" ###-- Create hash with files for rolling from dir above --### dirhsh = Hash.new 0 dirhsh["vrdevlogs"] = Dir.glob("*.{log,out}") dirhsh["vrdevgzlogs"] = Dir.glob("*.{log,out}.gz") if ( dirhsh.length > 0 ) puts "yes" dirhsh.each_value { |value| puts dirhsh.inspect if (File.size?(value) > FSIZE) puts "Yes its larger" end else raise StandardError, "Hash 'dirhsh' has no values, logs will not be rolled!" end -- Posted via http://www.ruby-forum.com/.