fn recursive_scan(path: &Path) -> Vec<PathBuf> {
    if !path.is_dir() {
        return vec![];
    }

    let mut paths = vec![path.to_path_buf()];

    // read all files/dirs in path at depth 1
    let tmp_paths = match read_dir(&path) {
        Ok(v) => v,
        Err(e) => {
            error!("failed accessing {:?}: {:?}", path, e);
            return paths;
        }
    };
    // iterate over all the paths and call recursive_scan on all dirs
    for tmp_path in tmp_paths {
        let path = match tmp_path {
            Ok(path) => path.path(),
            Err(e) => {
                error!("failed scanning directory {:?}: {:?}", path, e);
                continue;
            }
        };
        // if the path is a dir then recursively scan it also
        // so that we have an unlimited depth scan
        if path.is_dir() {
            paths.append(&mut recursive_scan(&path))
        } else {
            paths.push(path)
        }
    }

    paths
}
// recursively scans a directory for unlimited depth
recursively scans a directory for unlimited depth
recursively scans a directory for unlimited depth
fn recursive_scan(path: &Path) -> Vec<PathBuf> {
    if !path.is_dir() {
        return vec![];
    }
    let mut paths = vec![path.to_path_buf()];
    // read all files/dirs in path at depth 1
    let tmp_paths = match read_dir(&path) {
        Ok(v) => v,
        Err(e) => {
            error!("failed accessing {:?}: {:?}", path, e);
            return paths;
        }
    };
    // iterate over all the paths and call recursive_scan on all dirs
    for tmp_path in tmp_paths {
        let path = match tmp_path {
            Ok(path) => path.path(),
            Err(e) => {
                error!("failed scanning directory {:?}: {:?}", path, e);
                continue;
            }
        };
        // if the path is a dir then recursively scan it also
        // so that we have an unlimited depth scan
        if path.is_dir() {
            paths.append(&mut recursive_scan(&path))
        } else {
            paths.push(path)
        }
    }
    paths
}
fn recursive_scan ( path : & Path ) -> Vec < PathBuf > { if ! path . is_dir ( ) { return vec ! [ ] ; } let mut paths = vec ! [ path to_path_buf ( ) ] ; // read all files/dirs in path at depth 1 let tmp_paths = match read_dir ( & path ) { Ok ( v ) => v , Err ( e ) => { error ! ( " " path e ) ; return paths ; } } ; // iterate over all the paths and call recursive_scan on all dirs for tmp_path in tmp_paths { let path = match tmp_path { Ok ( path ) => path . path ( ) , Err ( e ) => { error ! ( " " path e ) ; continue ; } } ; // if the path is a dir then recursively scan it also // so that we have an unlimited depth scan if path . is_dir ( ) { paths . append ( & mut recursive_scan ( & path ) ) } else { paths . push ( path ) } } paths }
recursively scans a directory for unlimited depth
recursively scans a directory for unlimited depth
path
&Path
path
&Path