use std::fs;
use std::io::Error;
fn create_folder(path: &str) -> Result<(), Error> {
match fs::create_dir_all(path) {
Ok(_) => {
println!("文件夹创建成功: {}", path);
Ok(())
}
Err(e) => {
eprintln!("创建文件夹失败: {} - 错误: {}", path, e);
Err(e)
}
}
}
fn main() -> Result<(), Error> {
let folder_path = "path/to/your/folder";
create_folder(folder_path)?;
Ok(())
}
如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!
txttool.com 说一段 esp56物联 查询128 IP查询