From: Tim Hammerquist Date: 2002-07-02T16:31:04+09:00 Subject: Re: Question: ruby vs. ksh Philip Mak graced us by uttering: > On Tue, Jul 02, 2002 at 09:10:35AM +0900, Tim Hammerquist wrote: >> # 2) >> >> 'foo/bar'.split('/').each do |dir| >> Dir::mkdir(dir) >> end > > Isn't that going to do this: > > mkdir foo > mkdir bar > > instead of this: > > mkdir foo > mkdir foo/bar *smack!* Of course! I apologize. I didn't think it through. >> # 3) >> require "ftools" # standard library >> File::mkpath('foo/bar') > > This seems like the cleanest way to do it. This was, of course, my personal favorite. I tend to show people the hard way before showing them the simpler way... just like my Calc prof used to. Again, my apologies. Use File::mkpath() Tim Hammerquist -- Randal can write one-liners again. Everyone is happy, and peace spreads over the whole Earth. -- Larry Wall in <199705101952.MAA00756@wall.org>