From: John Maclean Date: 2006-02-12T22:02:11+09:00 Subject: Re: Itterating through one's path(s) On Sun, 12 Feb 2006 13:23:24 +0900 "Scott" wrote: > I'm not exactly sure what your're trying to accomplish. If you're > trying to get a list of all the files that are under each path in the > ENV['PATH'] variable, methinks this'll work: > > files = [] > filter = /^\./, /~$/, /\.o/ # btw, this regex is invalid. > ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| > files.concat Dir.open(path).select { |d| !d.match(filter) } > end > > If thats totally not what you're trying to do, then maybe you could > clarify? Also, the regex you list isnt valid, the forward slashes > need to be escaped, but even then, there wont be any forward slashes > in your file names. > > Scott > > > > -- John Maclean MSc (DIC) 07739 171 531 Thanks for the reply and tip. You've guessed correctly that all I'm wanting to do is to list all of the files in my $PATH. I included the listing of /usr/.../dir.rb just to show that there's some "test" source code on my system and that it uses a nested for loop.