?
Solved

Create a sub-directory with read permission attributes.

Posted on 2006-05-04
6
Medium Priority
?
964 Views
Last Modified: 2008-01-09
I have created a sub-directory, but it seems to have the read-only attribute set.  I have looked and looked and can't find a way to create the directory and set the read-only attribute to false.  

I go in manually and unclick the read-only attribute, only to have it reset automatically somehow... very confusing... can someone enlighten me as to why it keeps getting reset?  (OS is Windows XP)

Thanks in advance.
0
Comment
Question by:rmmarsh
  • 3
  • 2
6 Comments
 
LVL 35

Assisted Solution

by:mrichmon
mrichmon earned 750 total points
ID: 16607027
Check the parent folder and see if it is set to have permissions propogate to child objects.
0
 
LVL 11

Accepted Solution

by:
Expert1701 earned 750 total points
ID: 16607068
Suppose you have a folder "New Folder" in the root directory of drive C, with the read-only attribute set,

  string directory = @"C:\New Folder";

You can remove with this:

  System.IO.DirectoryInfo directoryInfo = new System.IO.DirectoryInfo(directory);
  directoryInfo.Attributes = directoryInfo.Attributes & ~System.IO.FileAttributes.ReadOnly;

or this:

  System.IO.File.SetAttributes(directory, System.IO.File.GetAttributes(directory) & ~System.IO.FileAttributes.ReadOnly);
0
 

Author Comment

by:rmmarsh
ID: 16608602
Doesn't work on an XP system... no matter what I do, the Read-Only attribute remains set.  I go to the parent directory, remove the RO attribute, click on "all sub-folders" and click on Apply.  When I go back to the Directory, the RO bit is set... no way to remove it.

I ran into this once before, but for the life of me, I don't remember what I did to remove the RO attribute permanently.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 35

Expert Comment

by:mrichmon
ID: 16608656
Is the archive box checked? inside advanced properties?
0
 

Author Comment

by:rmmarsh
ID: 16608762
No...
0
 

Author Comment

by:rmmarsh
ID: 16608991
Now I remember... in XP you can not do a backup to any directory in the c:\program files directory.

Thanks guys for your help anyway...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Screencast - Getting to Know the Pipeline

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question