Iterating over directories.
parent
61267f4443
commit
3ccc66b5d7
@ -1,3 +1,21 @@
|
||||
use std::{env, fs::FileType};
|
||||
use walkdir::DirEntry;
|
||||
use walkdir::WalkDir;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
let mut args = env::args();
|
||||
let _program = args.next().expect("argv[0] should be this program?");
|
||||
let profile = args.next().expect("Must provide a profile");
|
||||
let directories: Vec<String> = args.collect();
|
||||
|
||||
let mut files: Vec<DirEntry> = Vec::new();
|
||||
for dir in directories {
|
||||
for entry in WalkDir::new(dir) {
|
||||
let entry = entry.unwrap();
|
||||
if entry.file_type().is_file() {
|
||||
eprintln!("{}", entry.path().display());
|
||||
files.push(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue