From: Tim Hammerquist Date: 2006-01-25T00:39:04+09:00 Subject: Re: Which Directory was my ruby script run from? Matthew John wrote: > I've written a little script to test, and it looks like the > second reply by Mike is the only one that works. The other > two provide me with the location of the file, not the > directory where the file was run from. Excellent! I love seeing posters get resourceful with the answers they receive! This makes me happy. :) Yes, File.dirname and Dir.getwd do two very different things, which you discovered. There seems to have been a small misunderstanding. File.dirname simply does string manipulation on its argument, whereas Dir.getwd actually gets the directory from which the current script ($0) was invoked... which is what you were asking for. BTW, $0 and $PROGRAM_NAME are aliases for the same variable. > Thanks for your help. Thank you for making the most of the help offered! Cheers! Tim Hammerquist