Function std::fs::remove_dir_all1.0.0[−][src]

pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> Result<()>
Expand description

删除目录中的所有内容后,将在此路径中删除该目录。小心使用!

此函数不跟随符号链接,它会简单地删除符号链接本身。

平台特定的行为

该函数当前对应于 Unix 上的 opendir,lstat,rm 和 rmdir 函数,以及 Windows 上的 FindFirstFile,GetFileAttributesEx,DeleteFile 和 RemoveDirectory 函数。

注意,这个 may change in the future。

Errors

请参见 fs::remove_file 和 fs::remove_dir。

Examples

use std::fs;

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