From: Matthew Margolis Date: 2004-08-05T10:44:18+09:00 Subject: Re: open files in other directories Mehr, Assaph (Assaph) wrote: >>Thank you very much. As a ruby noob I am still learning the built in >> >> >methods. > > >>I didn't even think to use glob. >> >> > >No worries - that's what this list is for :) > >It just hit me: > > >>> campershash["#{textfilename.chop.chop.chop.chop}"] = >>> >>> >>Try textfilename[0..-5] for a fixed size slice. >> >> > >You're probably trying to remove the extension. Take a look at File >class methods: basename, extname, dirname etc. You can strip extension >by: > base_name = textfilename.delete File.extname(textfilename) > > > Excellent. The multiple chops were a quick hack I threw together for testing purposes. I was going to go searching for a better way to actually remove the extension in a bit but I guess I don't have to do that now. Thank you for saving me some time, Matthew Margolis