belongs to collection: Ruby Directories Programs
In this program, we will create a directory using Dir.mkdir() method and print the appropriate message.
Program/Source Code:
The source code to create a directory is given below. The given program is compiled and executed on Windows 10 Operating System successfully.
# Ruby program to create a directory if (Dir.mkdir("mydir") == 0) puts "Directory created successfully"; else puts "Directory creation failed"; end
Output:
Directory created successfully
Explanation:
In the above program, we created a directory mydir using Dir.mkdir() method. The Dir.mkdir() method returns 0 on successful creation of directory.
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Program/Source Code:
The source code to create a directory is given below. The given program is compiled and executed on Windows 10 Operating System successfully.
Output:
Explanation:
In the above program, we created a directory mydir using Dir.mkdir() method. The Dir.mkdir() method returns 0 on successful creation of directory.
need an explanation for this answer? contact us directly to get an explanation for this answer