Hi Trans, Trans wrote: > I need to split a path by head/*tail. > > Ex. > > File.head_tail_split('home/foo/bar') #=> [ 'home', 'foo/bar' ] > You could do like this. def head_tail_split(fname) components = fname.split('/') [components.shirt, components.join('/')] end irb(main):001:0> fname = 'home/foo/bar' => "home/foo/bar" irb(main):002:0> components = fname.split('/') => ["home", "foo", "bar"] irb(main):003:0> [components.shift, components.join('/')] => ["home", "foo/bar"] HTH, Bill