Home  »  CodeGuidesProgrammingSnippetsTechnology   »   Rust Create Directory if Not Exists Code

Rust Create Directory if Not Exists Code

Posted: September 11, 2022 | by Michael Bright

Rust create directory if not exists example snippet:

use std::fs;

fn main() -> std::io::Result<()> {
    fs::create_dir_all("/some/dir")?;
    Ok(())
}

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.