|
-
July 22nd, 2009, 09:15 AM
#1
How to set the read-only property of a directory and its content programmatically?
Hi,
Files and \irectories in Windows (XP) have the property "Read Only".
How can I, programmatically, set the "Read Only" property of a certain directory so it will apply to all its content (files and subdirectories) ?
The FileInfo class has a "ReadOnly" property, so it's not a problem, we can go over all the files in the directory recursivelt and set their ReadOnly property to false.
But directories don't have this property. Instead they have the "Attributes" property, which can be assigned with FileAttributes.ReadOnly, but I tried several things and it didn't actually worked.
A solution which doesn't include enumerating all the files and sub directories in the directory will be preferred, but any other solution will be OK too.
Regards
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|