Function std::fs::metadataUnstable [-] [+] [src]

pub fn metadata<P: AsPath + ?Sized>(path: &P) -> Result<Metadata>

Given a path, query the file system to get information about a file, directory, etc.

This function will traverse soft links to query information about the destination file.

Example

fn main() { fn foo() -> std::io::Result<()> { use std::fs; let attr = try!(fs::metadata("/some/file/path.txt")); // inspect attr ... Ok(()) } }
use std::fs;

let attr = try!(fs::metadata("/some/file/path.txt"));
// inspect attr ...

Errors

This function will return an error if the user lacks the requisite permissions to perform a metadata call on the given path or if there is no entry in the filesystem at the provided path.