Ruby: Iterate thought all .rb (including subfolders) files in the folder

Viewed 6916

Files structure:

folderA/
 - folder1/
   - file1.rb
   - file2.rb
 - folder2/
   - folder1/
     - file1.rb
   - folder2/
     - file1.rb
 - file1.rb
 - file2.rb

With code below i can iterate only on folderA/file1.rb and folderA/file2.rb

# EDITTED
Dir.glob('folderA/*.rb') do |file|
  puts file
end

Is it possible to iterate over all .rb files (including subfolders) within only using glob (without Dir.foreach(dir)..if..)?

P.S. Ruby v.1.8.6

3 Answers
Related