How to create path subdirectories

Hi-
looking for a way to create /test1/test2/test3/test4 subdirectories all
together. I was looking at Dir.mkdir but can’t do
Dir.mkdir("./test1/test2/test3/test4"). I’m pretty new in ruby and not
sure how to do it the ruby way … the only way I can think of is to do
a array loop to make the dir. And maybe someone has write a code about
it. any help or suggestion?

kean

kean wrote:

Hi-
looking for a way to create /test1/test2/test3/test4 subdirectories all
together. I was looking at Dir.mkdir but can’t do
Dir.mkdir(“./test1/test2/test3/test4”). I’m pretty new in ruby and not
sure how to do it the ruby way … the only way I can think of is to do
a array loop to make the dir. And maybe someone has write a code about
it. any help or suggestion?

No loop needed :slight_smile:

require ‘ftools’
File.mkpath(‘test1/test2/test3/test4’)

Joel VanderWerf wrote:

No loop needed :slight_smile:

require ‘ftools’
File.mkpath(‘test1/test2/test3/test4’)

thanks it’s work like a charm:)