Function fs_extra::dir::create_all [] [src]

pub fn create_all<P>(path: P, erase: bool) -> Result<()> where
    P: AsRef<Path>, 

Recursively create a directory and all of its parent components if they are missing.

This function takes to arguments:

  • path - Path to new directory.

  • erase - If set true and folder exist, then folder will be erased.


This function will return an error in the following situations, but is not limited to just these cases:

  • User lacks permissions to create directory at path.

  • path already exists if erase set false.


    Be careful when using this code, it's not being tested!
    extern crate fs_extra;
    use fs_extra::dir::create_all;
    create_all("/some/dir", false); // create directory some and dir