pub fn dir_to_file_list<AnyPath0>(
path: AnyPath0,
) -> Result<Vec<OsString>, Box<FetchDataError>>
Expand description
List all the files in a local directory.
ยงExample
use fetch_data::{dir_to_file_list, download};
use temp_testdir::TempDir;
// Create a local directory and download two files to it.
let temp_dir = TempDir::default();
download(
"https://raw.githubusercontent.com/CarlKCarlK/fetch-data/main/tests/data/small.fam",
temp_dir.join("small.fam"),
)?;
download(
"https://raw.githubusercontent.com/CarlKCarlK/fetch-data/main/tests/data/small.bim",
temp_dir.join("small.bim"),
)?;
// List the files in the directory.
let file_list = dir_to_file_list(temp_dir)?;
println!("{file_list:?}"); // Prints ["small.bim", "small.fam"]