Suppost I want to create a directory like “a/b/c” under the current dir.
How to make it?
I have tried this:
Dir.mkdir("a/b/c").
However it does not work.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I guess this is because parent directories of c do not exist. If you try to do the same in the shell you will also get an error. You can force creation of parent directories if they do not exist with the -p option:
which in Ruby can be done with mkdir_p found in the FileUtils module: