Answers for "search in dir rust"

0

search in dir rust

use std::fs;

fn is_file(name: String) -> bool {
    let paths = fs::read_dir("").unwrap();
    for path in paths {
        let dir_name = path.unwrap().path().into_os_string().into_string().unwrap();
        if dir_name == name {
            return true
        }
    }
    return false
}
Posted by: Guest on May-07-2022

Browse Popular Code Answers by Language