To change directory within a Ruby program, use Dir.chdir:
Dir.chdir("/usr/bin")
This example changes the current directory to /usr/bin.
You can find out what the current directory is with Dir.pwd.
For example, here's the result on my installation:
puts Dir.pwd Dir.chdir("C:/") puts Dir.pwd# from ww w . j a v a2 s .co m