Directory within directorry??

S

Saurabh Peshkar

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
 
H

Heesob Park

Hi,

2009/3/18 Saurabh Peshkar said:
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?
require 'fileutils'
FileUtils.mkdir_p "#{RAILS_ROOT}/public/public1/public2/public3"


Regards,

Park Heesob
 
C

Clifford Heath

Saurabh said:
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")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,141
Messages
2,570,817
Members
47,364
Latest member
Stevanida

Latest Threads

Top