remove_dir_all
fn remove_dir_all(string path) -> Result<unit, IoError> Import
Source: use io::fs::{remove_dir_all}; compiler/src/builtin_docs/io/fs.hy Removes the directory path and everything inside it.
Symbolic links inside are removed, not followed. Returns
Err(IoError::NotFound) when path does not exist.
Needs --allow-write.
Parameters#
| Name | Type |
|---|---|
path | string |
Returns#
Result<unit, IoError>
Examples#
use io::fs::{create_dir_all, exists, remove_dir_all};
use io::file::{write_text};
use tests::assert;
let _ = create_dir_all("/tmp/coil_doc_fs_rda/x/y");
let _ = write_text("/tmp/coil_doc_fs_rda/x/y/f.txt", "z");
let removed = match remove_dir_all("/tmp/coil_doc_fs_rda") {
Result::Ok(_) => true,
Result::Err(_) => false,
};
let left = match exists("/tmp/coil_doc_fs_rda") {
Result::Ok(b) => b,
Result::Err(_) => true,
};
assert!(removed && !left);
See also#
copy: Copies the contents of filefromtoto, creating or overwritingto.create_dir: Creates the directorypath.create_dir_all: Creates the directorypathand any missing parent directories.exists: Returns whether anything exists atpath.is_dir: Returns whetherpathis a directory, following symbolic links.is_file: Returns whetherpathis a regular file, following symbolic links.is_symlink: Returns whetherpathitself is a symbolic link (the link is not followed).list_dir: Returns the names of the entries in directorypath, sorted.