From: Philip Mak Date: 2002-09-18T01:28:55+09:00 Subject: How to tell what directory the current file is in? How can I tell what directory the current file being executed is in? This is not necessarily the same directory as returned by "Dir.pwd". I have "/home/seasft/dev/global" in my path. Inside this directory, there is: entity.rb entity/staff.rb entity/project.rb entity/section.rb ... I want entity.rb to load all the .rb files inside the "entity" directory. I'm trying this right now: File.find('entity') do |f| load f if f =~ /\.rb$/ end But, that uses the current working directory, rather than the directory that entity.rb is located in. I can't figure out how to determine what directory entity.rb is in, and I'd rather not have to hardcode the path because I have two copies of the system running in different places.