From: Jeremy Bopp Date: 2011-09-07T23:21:16+09:00 Subject: Re: Recursive file listening? On 9/7/2011 08:43, Andrius C. wrote: > Sorry for bumping old thread, but as it was first result for me in > google I'd like to add that Dir.glob('**/*.rb') won't actually list > files recursively. It will only list files in current directory and 1 > directory deep. So if you have files: > > file > first_level/file > first_level/second_level/file > > It will return only "file" and "first_level/file", but will not return > "first_level/second_level/file". Did you actually test this? I did, and here is what I got: jeremyb@JEREMYB ~/tmp/test $ mkdir -p first_level/second_level jeremyb@JEREMYB ~/tmp/test $ touch file.rb first_level/file.rb first_level/second_level/file.rb jeremyb@JEREMYB ~/tmp/test $ find . . ./file.rb ./first_level ./first_level/file.rb ./first_level/second_level ./first_level/second_level/file.rb jeremyb@JEREMYB ~/tmp/test $ ruby -e 'puts Dir.glob("**/*.rb").join("\n")' file.rb first_level/file.rb first_level/second_level/file.rb The meaning of ** in the glob means to match any and all intervening directories at that point in the pattern. Can you explain why you think that is not the case? -Jeremy