Forum: Ruby Directory within directorry??

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
071e291a1589fe24f339c2cedca829df?d=identicon&s=25 Saurabh Peshkar (saurabh)
on 2009-03-18 07:26
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
666b4e17b4bb0e2d999037a25f65a7cb?d=identicon&s=25 Heesob Park (phasis)
on 2009-03-18 07:32
(Received via mailing list)
Hi,

2009/3/18 Saurabh Peshkar <saurabh@cipher-tech.com>:
> 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 Heesob
163755a5d3a5c57bd79c4f41bdda7a22?d=identicon&s=25 Clifford Heath (Guest)
on 2009-03-18 07:40
(Received via mailing list)
Saurabh Peshkar 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 topic is locked and can not be replied to.