# How to refer to the .rb files in a folder?

**URL:** <https://www.ruby-forum.com/t/how-to-refer-to-the-rb-files-in-a-folder/170769>\
**Category:** IronRuby\
**Created:** [June 22, 2009, 5:26pm UTC](https://www.ruby-forum.com/t/how-to-refer-to-the-rb-files-in-a-folder/170769 "2009-06-22T17:26:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![metanoize](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc29f/32.png) [@metanoize](https://www.ruby-forum.com/u/metanoize)\
**Post date:** [June 22, 2009, 5:26pm UTC](https://www.ruby-forum.com/t/how-to-refer-to-the-rb-files-in-a-folder/170769/1 "2009-06-22T17:26:24Z")

</div>

I am trying to refer to all the libraries (modules) in the libs folder  
how can I achieve that:

require ‘C:\ironruby\ironruby\Merlin\Main\Languages\Ruby\Libs’

The above code does not work!

---

<div class="post-metadata">

**Author:** ![metanoize](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc29f/32.png) [@metanoize](https://www.ruby-forum.com/u/metanoize)\
**Post date:** [June 22, 2009, 5:40pm UTC](https://www.ruby-forum.com/t/how-to-refer-to-the-rb-files-in-a-folder/170769/2 "2009-06-22T17:40:38Z")

</div>

Dir.chdir(".") do  
Dir["\*.rb"].each do |f|  
require f  
end  
end

I don’t know of a way in Ruby to do what you are asking for without  
looping through the files.  
Thanks,

JD

…there is no try
