[][src]Function fungus::sys::files

pub fn files<T: AsRef<Path>>(path: T) -> FuResult<Vec<PathBuf>>

Returns all files for the given path, sorted by filename. Handles path expansion. Paths are returned as abs paths. Doesn't include the path itself only its children nor is this recursive.

Examples

use fungus::prelude::*;

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