<p>For this directory structure:</p>

<pre><code>.
|-- README.txt
|-- firstlevel.rb
`-- lib
    |-- models
    |   |-- foo
    |   |   `-- fourthlevel.rb
    |   `-- thirdlevel.rb
    `-- secondlevel.rb

3 directories, 5 files
</code></pre>

<p>The glob would match: </p>

<pre><code>firstlevel.rb 
lib/secondlevel.rb 
lib/models/thirdlevel.rb
lib/models/foo/fourthlevel.rb
</code></pre>

[{'answer_id': 44486, 'author': 'James A. Rosen', 'author_id': 1190, 'author_profile': 'https://Stackoverflow.com/users/1190', 'pm_score': 1, 'selected': False, 'text': "<p>In Ruby itself:</p>\n\n<pre><code>Dir.glob('**/*.rb') perhaps?\n</code></pre>\n"}, {'answer_id': 44494, 'author': 'Chris AtLee', 'author_id': 4558, 'author_profile': 'https://Stackoverflow.com/users/4558', 'pm_score': 2, 'selected': False, 'text': '<p>In zsh, <code>**/*.rb</code> works</p>\n'}, {'answer_id': 44599, 'author': 'quackingduck', 'author_id': 3624, 'author_profile': 'https://Stackoverflow.com/users/3624', 'pm_score': 0, 'selected': False, 'text': '<p>Looks like it can\'t be done from <code>bash</code></p>\n\n<p>If you using <code>zsh</code> then</p>\n\n<pre><code>ls **/*.rb\n</code></pre>\n\n<p>will produce the correct result. </p>\n\n<p>Otherwise you can hijack the <code>ruby</code> interpreter (and probably those of other languages) </p>\n\n<pre><code>ruby -e "puts Dir.glob(\'**/*.rb\')"\n</code></pre>\n\n<p>Thanks to Chris and Gaius for your answers.</p>\n'}, {'answer_id': 44651, 'author': 'Nick', 'author_id': 1236, 'author_profile': 'https://Stackoverflow.com/users/1236', 'pm_score': 3, 'selected': True, 'text': "<p>Apologies if I've missed the real point of the question but, if I was using sh/bash/etc., then I would probably use <em>find</em> to do the job:</p>\n\n<pre><code>find . -name '*.rb' -type f\n</code></pre>\n\n<p>Globs can get a bit nasty when used from within a script and <em>find</em> is much more flexible.</p>\n"}]
['https://Stackoverflow.com/questions/44481', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3624/']