471,616 Members | 1,280 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,616 software developers and data experts.

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 16386
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 XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
1 post views Thread by ZEDKYRIE | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.