From: John Maclean Date: 2006-02-12T11:07:04+09:00 Subject: Itterating through one's path(s) I'd like to see if I can itterate through the directories of my PATH (or $PATH for Unix-based systems) using blocks. #!/usr/bin/ruby -w path = ENV['PATH'].split(File::PATH_SEPARATOR) path.each{|zz| Dir.new zz} There's an example of using nested for loops in file:///usr/share/doc/ruby-1.8.4/sample/dir.rb .... # directory access # list all files but .*/*~/*.o dirp = Dir.open(".") for f in dirp case f when /^\./, /~$/, /\.o/ # do not print else print f, "\n" end end dirp.close -- John Maclean MSc (DIC) 07739 171 531