Directory within directorry?

Hi All,

I want to create a directory, i used command:

Dir.mkdir("#{RAILS_ROOT}/public/public1/public2/public3")

but its not working. don’t know the reason.
So i tried for:

Dir.mkdir("#{RAILS_ROOT}/public/public1")
Dir.mkdir("#{RAILS_ROOT}/public/public1/public2")
Dir.mkdir("#{RAILS_ROOT}/public/public1/public2/public3")

and it worked.

Can the code be minimized?
Please suggest me, can the three lined code be made one lined?

Thanks
Saurabh

Hi,

2009/3/18 Saurabh P. [email protected]:

Dir.mkdir("#{RAILS_ROOT}/public/public1/public2")
Dir.mkdir("#{RAILS_ROOT}/public/public1/public2/public3")

and it worked.

Can the code be minimized?
Please suggest me, can the three lined code be made one lined?

require ‘fileutils’
FileUtils.mkdir_p “#{RAILS_ROOT}/public/public1/public2/public3”

Regards,

Park H.

Saurabh P. wrote:

I want to create a directory, i used command:
Dir.mkdir("#{RAILS_ROOT}/public/public1/public2/public3")
Can the code be minimized?

require ‘fileutils’
FileUtils::mkpath("#{RAILS_ROOT}/public/public1/public2/public3")

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs