pub fn build_file_list(dir: &str, filenames: &mut Vec<String>, ext: &str) -> Result<()> {
    let metadata = metadata(dir)?;
    if metadata.is_file() {
        if dir.ends_with(ext) {
            filenames.push(dir.to_string());
        }
    } else {
        for entry in fs::read_dir(dir)? {
            let entry = entry?;
            let path = entry.path();
            if let Some(path_name) = path.to_str() {
                if path.is_dir() {
                    build_file_list(path_name, filenames, ext)?;
                } else if path_name.ends_with(ext) {
                    filenames.push(path_name.to_string());
                }
            } else {
                return Err(DataFusionError::Plan("Invalid path".to_string()));
            }
        }
    }
    Ok(())
}
/// Recursively build a list of files in a directory with a given extension
Recursively build a list of files in a directory with a given extension
Recursively build a list of files in a directory with a given extension
pub fn build_file_list(dir: &str, filenames: &mut Vec<String>, ext: &str) -> Result<()> {
    let metadata = metadata(dir)?;
    if metadata.is_file() {
        if dir.ends_with(ext) {
            filenames.push(dir.to_string());
        }
    } else {
        for entry in fs::read_dir(dir)? {
            let entry = entry?;
            let path = entry.path();
            if let Some(path_name) = path.to_str() {
                if path.is_dir() {
                    build_file_list(path_name, filenames, ext)?;
                } else if path_name.ends_with(ext) {
                    filenames.push(path_name.to_string());
                }
            } else {
                return Err(DataFusionError::Plan("Invalid path".to_string()));
            }
        }
    }
    Ok(())
}
pub fn build_file_list ( dir : & str , filenames : & mut Vec < String > , ext : & str ) -> Result < ( ) > { let metadata = metadata ( dir ) ? ; if metadata . is_file ( ) { if dir . ends_with ( ext ) { filenames . push ( dir . to_string ( ) ) ; } } else { for entry in fs :: read_dir ( dir ) ? { let entry = entry ? ; let path = entry . path ( ) ; if let Some ( path_name ) = path . to_str ( ) { if path . is_dir ( ) { build_file_list ( path_name , filenames , ext ) ? ; } else if path_name . ends_with ( ext ) { filenames . push ( path_name . to_string ( ) ) ; } } else { return Err ( DataFusionError :: Plan ( " " . to_string ( ) ) ) ; } } } Ok ( ( ) ) }
Recursively build a list of files in a directory with a given extension
Recursively build a list of files in a directory with a given extension
dir
&str
filenames
&mut Vec<String>
ext
&str
dir
&str
filenames
&mut Vec<String>
ext
&str