pub fn get_dir_content<P>(path: P) -> Result<DirContent>
Expand description
Return DirContent which contains information about directory:
- Size of the directory in bytes.
- List of source paths of files in the directory (files inside subdirectories included too).
- List of source paths of all directories and subdirectories.
§Errors
This function will return an error in the following situations, but is not limited to just these cases:
- This
path
directory does not exist. - Invalid
path
. - The current process does not have the permission to access
path
.
§Examples
ⓘ
extern crate fs_extra;
use fs_extra::dir::get_dir_content;
let dir_content = get_dir_content("dir")?;
for directory in dir_content.directories {
println!("{}", directory); // print directory path
}