- 1 year ago 80
Ruby Question

Can a Ruby script tell what directory it’s in?

Answer Source

File.dirname(__FILE__) will give you the path relative to the script being run. File.expand_path(File.dirname(__FILE__)) will give you the absolute path.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download