The source code to create a directory using the create_dir_all() function is given below. The given program is compiled and executed on UBUNTU 18.04 successfully.
// Rust program to create a directory
// using create_dir_all() function
use std::fs;
fn main() -> std::io::Result<()> {
fs::create_dir_all("NewDir")?;
println!("NewDir directory created successfully\n");
Ok(())
}
Output:
$ rustc main.rs
$ ./main
NewDir directory created successfully
Explanation:
Here, we created a directory MyDir using the create_dir_all() function and print the appropriate message.
Program/Source Code:
The source code to create a directory using the create_dir_all() function is given below. The given program is compiled and executed on UBUNTU 18.04 successfully.
Output:
Explanation:
Here, we created a directory MyDir using the create_dir_all() function and print the appropriate message.
need an explanation for this answer? contact us directly to get an explanation for this answer