From: Martin DeMello Date: 2008-07-28T14:48:26+09:00 Subject: Re: head/tail split for path On Sun, Jul 27, 2008 at 11:47 AM, Thomas Sawyer wrote: >> irb(main):002:0> components = fname.split('/') >> => ["home", "foo", "bar"] >> irb(main):003:0> [components.shift, components.join('/')] >> => ["home", "foo/bar"] > > That's basically were I ended up too, but using David's File::Separator > suggestion. Don't forget the second argument to split - it'd be handy here. first, rest = fname.split(File::Separator, 2) though you'd probably have to thrown in an if fname.index(File::Separator) == 0 then fname = fname[1..-1] first martin