4

I see how to create a file with the attribute.

let file = OpenOptions::new()
    .write(true)
    .create(true)
    .attributes(winapi::FILE_ATTRIBUTE_HIDDEN)
    .open("foo.txt");

I also see that std::os::windows::fs::MetadataExt will return the attribute mask.

However, I'd like to create a directory or set a directory's attribute with the hidden flag. I dug through the fs:: and Windows sources and I don't see anything.

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
marathon
  • 7,881
  • 17
  • 74
  • 137
  • 1
    It seems you have to use `winapi` crate to achieve it. See [this](https://docs.rs/winapi/0.3.6/winapi/um/fileapi/fn.SetFileAttributesA.html) function and [docs](https://learn.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-setfileattributesa) for it – Artemij Rodionov Jan 14 '19 at 06:29

0 Answers0