From: Robert Klemme Date: 2004-03-31T19:19:22+09:00 Subject: Re: [newbie] prob with join "/" "gabriele renzi" schrieb im Newsbeitrag news:pi3l6056a0plvp0q1mprgl5akrdau76371@4ax.com... > il Wed, 31 Mar 2004 10:26:23 +0200, yvon.thoravalNO-SPAM@free.fr (Yvon > Thoraval) ha scritto:: > > >i get a very small prob with join : > > > >(fs stands for file.separator) > > use File.join() and you'r life will be beter :) .... together wit File.split(): dir, base = File.split fileName complete = File.join dir, base The error is easily explained by the behavior of split: irb(main):010:0> ar = "/foo/bar".split '/' => ["", "foo", "bar"] irb(main):011:0> ar.join '/' => "/foo/bar" Note the empty element at the beginning. compact() doesn't change that since it removes only nils: irb(main):013:0> ar = "/foo/bar".split( '/' ).compact => ["", "foo", "bar"] irb(main):014:0> ar.join '/' => "/foo/bar" However, File.split and File.join are used much easier and I guess they are more appropriate in your case. Regards robert