469,283 Members | 2,263 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,283 developers. It's quick & easy.

Set Attributes of a Directory

Hello,

How can I set the attributes for a directory? The File class has a
SetAttributes method, however the Directory class does not.

Thanks in advance,
cj
Jan 13 '06 #1
5 16194
Hi again,

I think I just found the answer. SetAccessControl on the DirectoryInfo
object.

Thanks,
cj
"Curtis Justus" <no****@cjustus.m.s.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hello,

How can I set the attributes for a directory? The File class has a
SetAttributes method, however the Directory class does not.

Thanks in advance,
cj

Jan 13 '06 #2
DirectoryInfo has a settable Attributes property - try that?

Marc

"Curtis Justus" <no****@cjustus.m.s.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hello,

How can I set the attributes for a directory? The File class has a
SetAttributes method, however the Directory class does not.

Thanks in advance,
cj

Jan 13 '06 #3
That did it (contrary to my reply). Thanks again!
"Marc Gravell" <mg******@rm.com> wrote in message
news:OQ**************@TK2MSFTNGP11.phx.gbl...
DirectoryInfo has a settable Attributes property - try that?

Marc

"Curtis Justus" <no****@cjustus.m.s.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hello,

How can I set the attributes for a directory? The File class has a
SetAttributes method, however the Directory class does not.

Thanks in advance,
cj


Jan 13 '06 #4
If you wanted SetAccessControl, then Directory also has this as a static
method.

Marc

"Curtis Justus" <no****@cjustus.m.s.com> wrote in message
news:ul**************@tk2msftngp13.phx.gbl...
Hi again,

I think I just found the answer. SetAccessControl on the DirectoryInfo
object.

Thanks,
cj
"Curtis Justus" <no****@cjustus.m.s.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hello,

How can I set the attributes for a directory? The File class has a
SetAttributes method, however the Directory class does not.

Thanks in advance,
cj


Jan 13 '06 #5
You can use Class DirectoryInfo to do it as below


DirectoryInfo dirInfo = new DirectoryInfo(path);
dirInfo.Attributes = FileAttributes.Hidden;
Thanks
Jul 16 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by StGo | last post: by
1 post views Thread by Keith Jakobs, MCP | last post: by
1 post views Thread by John F. Holliday | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.