pub fn set_attribute(path: &Path, attrib: Attributes) -> boolExpand description
Set the attributes for a file.
This is very OS dependent and some attributes might do nothing on some operating systems.
§Params
file: Path -> The path to the file.
attrib: Attributes -> The attributes to add. (Bit-wise OR can be used to set multiple attributes.)
§Returns
bool -> If the attributes were set successfully. (If not check to make sure the file path exists.)
§Example
use std::path::Path;
use system_extensions::metadata::attribute::{set_attribute, Attributes};
set_attribute(Path::new("/test.txt"), Attributes::HIDDEN);Using more than one attribute:
use std::path::Path;
use system_extensions::metadata::attribute::{set_attribute, Attributes};
set_attribute(Path::new("/test.txt"), Attributes::HIDDEN | Attributes::READ_ONLY);