473,395 Members | 1,452 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 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 16572
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Audun | last post by:
Hi I've been trying to read the following attributes from Active Directory: networkAddress and netbootGUID. (Using c# and the DirectoryEntry class.) Tried to search, and explicitt load these...
4
by: Dave | last post by:
Hello. I am trying to update attributes in LDAP/Active directory from my application that is written in VB.NET. I am using Directory Services to do so. I do not get any errors during the...
3
by: Les Desser | last post by:
In A97 I am trying to determine some attributes of files in a folder - Date, time, file size and file name. To this end I have managed to create a batch file to do a Dir to a work file (and then...
3
by: StGo | last post by:
How can i read/write file's custom attributs(like subject,author...) in C#??? Thanks :))
7
by: John R. | last post by:
How do you set the following file attributes: Compressed Encrypted Normal ReparsePoint SparsePoint You CAN'T set these using FileInfo.Attributes or File.SetAttributes. It doesn't work for...
1
by: Keith Jakobs, MCP | last post by:
HELP!!!! VB.NET has been a thorn in my side, but trying to use the System.DirectoryServices namespace has to be one of the most ridiculously confusing classes I have EVER encountered!!!! Am I...
1
by: Tony Girgenti | last post by:
Hello. I'm trying to write a simple VS.NET 2003 VB program to delete files and directories on my hard drive. If the directory is read only, how do i change it's attribute so that i can delete...
1
by: John F. Holliday | last post by:
I need to use the ActiveDirectoryMembershipProvider in my application. I have setup the provider in the web config, etc. When I use the ASP.NET configuration utility and select the Security tab, it...
0
by: Kritin | last post by:
Hi, Could someone please guide me as to how shud i fetch opertional attributes like creatorsname,numsubordinates in my c# Windows Application. i m using DireetoryServices.It fetches me...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.