Possible duplicate:
How to create catalogs recursively in ruby?
In Ruby, how can I do:
mkdir -p cool/beans
Here is what I came up with:
Dir.mkdir('cool') unless File.directory?('cool') cool_beans_path = File.join('cool', 'beans') Dir.mkdir(cool_beans_path) unless File.directory?(cool_beans_path)
But is there a better way?
I know I could:
system('mkdir', '-p', File.join('cool', 'beans'))
But it is not platform independent, is it? For example, it works on a Mac, but not on Windows, right?
ruby file directory path mkdir
ma11hew28 Jul 13 '12 at 2:29 2012-07-13 02:29
source share