[][src]Function fungus::sys::all_files

pub fn all_files<T: AsRef<Path>>(path: T) -> Result<Vec<PathBuf>>

Returns all files for the given path recursively, sorted by filename. Handles path expansion. Paths are returned as abs paths. Doesn't include the path itself. Paths are guaranteed to be distinct.

Examples

use fungus::prelude::*;

let tmpdir = PathBuf::from("tests/temp").abs().unwrap().mash("path_doc_all_files");
assert!(sys::remove_all(&tmpdir).is_ok());
let file1 = tmpdir.mash("file1");
let dir1 = tmpdir.mash("dir1");
let file2 = dir1.mash("file2");
assert!(sys::mkdir(&dir1).is_ok());
assert!(sys::touch(&file1).is_ok());
assert!(sys::touch(&file2).is_ok());
assert_iter_eq(sys::all_files(&tmpdir).unwrap(), vec![file2, file1]);
assert!(sys::remove_all(&tmpdir).is_ok());