Mkdirs function?

Hello all,

is there a function to make multiple directories
like os.makedirs in Python?

I tried Dir.singleton_methods but nothing that
would fit.
if not can it be added to Ruby?

Regards, Daniel

piece of cake :slight_smile:

   def mkdirs(*dirs)
    dirs.each do |dir| Dir.mkdir(dir) end
   end

   mkdirs "dir1", "dir2" , "dir3"

···

On Mon, 21 Nov 2005 22:52:24 +0100, Daniel Schüle <uval@rz.uni-karlsruhe.de> wrote:

Hello all,

is there a function to make multiple directories
like os.makedirs in Python?

I tried Dir.singleton_methods but nothing that
would fit.
if not can it be added to Ruby?

Regards, Daniel

is there a function to make multiple directories
like os.makedirs in Python?

···

On 11/21/05, Daniel Schüle <uval@rz.uni-karlsruhe.de> wrote:
---
require 'ftools'

File.makedirs ("/path/that/does/not/exist")
---

File.makepath is also a sysnonym.

--
Rob

Rob Rypka wrote:

···

On 11/21/05, Daniel Schüle <uval@rz.uni-karlsruhe.de> wrote:

is there a function to make multiple directories
like os.makedirs in Python?

---
require 'ftools'

File.makedirs ("/path/that/does/not/exist")
---

File.makepath is also a sysnonym.

and mkdir_p :slight_smile:
V.-

--
http://www.braveworld.net/riva

____________________________________________________________________
http://www.freemail.gr - äùñåÜí õðçñåóßá çëåêôñïíéêïý ôá÷õäñïìåßïõ.
http://www.freemail.gr - free email service for the Greek-speaking.

Rob Rypka wrote:

is there a function to make multiple directories
like os.makedirs in Python?

---
require 'ftools'

File.makedirs ("/path/that/does/not/exist")

thx, that's what I looked for
I expected it to be a method of Dir

File.makepath is also a sysnonym.

Regards, Daniel

···

On 11/21/05, Daniel Schüle <uval@rz.uni-karlsruhe.de> wrote:

Daniel Schüle wrote:

Rob Rypka wrote:

is there a function to make multiple directories
like os.makedirs in Python?

---
require 'ftools'

File.makedirs ("/path/that/does/not/exist")

thx, that's what I looked for
I expected it to be a method of Dir

They're actually definedd in module FileUtils.
V.-

···

On 11/21/05, Daniel Schüle <uval@rz.uni-karlsruhe.de> wrote:

--
http://www.braveworld.net/riva

____________________________________________________________________
http://www.freemail.gr - äùñåÜí õðçñåóßá çëåêôñïíéêïý ôá÷õäñïìåßïõ.
http://www.freemail.gr - free email service for the Greek-speaking.

Hi

Damphyr wrote:

Rob Rypka wrote:

is there a function to make multiple directories
like os.makedirs in Python?

---
require 'ftools'

File.makedirs ("/path/that/does/not/exist")
---

File.makepath is also a sysnonym.

and mkdir_p :slight_smile:

irb(main):070:0> File.makedirs
=> []
irb(main):071:0> File.makepath
NoMethodError: undefined method `makepath' for File:Class
         from (irb):71
irb(main):072:0> File.mkdir_p
NoMethodError: undefined method `mkdir_p' for File:Class
         from (irb):72
irb(main):073:0>

File.makepath and File.mkdir_p seem to be undefined
as for the names I think makepath is a pretty fitting name
but I dont like abbrevations like mkdir_p
I always start guessing what may p stand for
File.makedirs is also very suitable name :slight_smile:

Regards, Daniel

···

On 11/21/05, Daniel Schüle <uval@rz.uni-karlsruhe.de> wrote:

         from :0

mkdir_p is not in ftools. It *is* in FileUtils. It is
Recommended(tm) that you use FileUtils instead of ftools, but I'm
lazy, and didn't look it up.

···

On 11/21/05, Damphyr <damphyr@freemail.gr> wrote:

Rob Rypka wrote:
> ---
> require 'ftools'
>
> File.makedirs ("/path/that/does/not/exist")
> ---
>
> File.makepath is also a sysnonym.
>
and mkdir_p :slight_smile:

---
require 'fileutils'

FileUtils::mkdir_p("/path/that/does/not/exist")
---

...

--
Rob

irb(main):070:0> File.makedirs
=> []
irb(main):071:0> File.makepath
NoMethodError: undefined method `makepath' for File:Class
         from (irb):71
         from :0

Sorry, that should be File.mkpath.

File.makepath and File.mkdir_p seem to be undefined
as for the names I think makepath is a pretty fitting name
but I dont like abbrevations like mkdir_p

mkdir_p is named as such because UNIX users get the same functionality
from 'mkdir -p' at the command line.

p stands for parents, as the parent directories are also created if necessary.

···

On 11/21/05, Daniel Schüle <uval@rz.uni-karlsruhe.de> wrote:

--
Rob