pub fn delete<T: AsPath + ?Sized>(path: &T) -> FsIOResult<()>
Expand description

Deletes the directory and any child file/directory.

Arguments

  • path - The directory path

Example

use crate::fsio::{directory, file};
use std::path::Path;

fn main() {
    file::ensure_exists("./target/__test/directory_test/delete_directory/dir1/dir2/file.txt").unwrap();
    let path = Path::new("./target/__test/directory_test/delete_directory");
    assert!(path.exists());

    let result = directory::delete("./target/__test/directory_test/delete_directory");
    assert!(result.is_ok());

    assert!(!path.exists());
}