use std::env;
use std::fs;
use std::path::PathBuf;
use std::path::Path;
fn find_file(start_dir: PathBuf, file: String) {
let paths = fs::read_dir(start_dir).unwrap();
for path in paths {
let full_path = path.as_ref().unwrap().path();
let is_directory = Path::new(&full_path).is_dir();
if is_directory {
println!("Name: {}{:?}", &full_path.display(), &is_directory);
find_file(full_path.clone(), file.clone());
} else {
println!("Name: {}{:?}", &full_path.display(), &is_directory);
}
}
}
I am trying to make a function that iterates through a file tree from a given start point, and it works, however, it always gives an "os code 5 error"(access denied error) when going through certain folders(ones that require admin perms to open), so I'm wondering if there is a way to ignore that error and keep going with the program