473,902 Members | 4,336 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Directory Always Read Only

Jim
I have the following piece of code:

Directory.Creat eDirectory(myDi r);
DirectoryInfo lDir = new DirectoryInfo(m yDir);
lDir.Attributes = FileAttributes. Normal;

When this code runs, my directory is created fine, but my directory is
always read only. At first I thought it was something with using
DirectoryInfo. However, I also ran the following line of code:

Directory.Creat eDirectory(myDi r);

Immediately after running this line of code, my directory was created, and
then I went and manually tried to change the attributes of the directory so
that it was not read only. Even after I tried to set it manually, it would
always be read only. I never received back an error after I pushed OK on
the directory properties after unchecking read only, but every time I go
back to the properties of the folder it is always read only?

This is running on Windows Vista. Any ideas why?

Thanks,
-- Jim
Jul 18 '07 #1
4 11842
Jim
Well, after doing more reading, it doesn't look like this is just me. This
guy's site:
http://www.followsteph.com/2007/06/1...sta-read-only/
has several references to threads in which people cannot change the
read-only property of a folder. My Google skills are failing me to find the
answer too. Does anybody know why I can't change the read-only property of
a folder on my Vista machine (it's a temporary folder I make in my Debug
directory during debugging)? More importantly, does anybody know how I can
fix this via normal administration and via code (some example code would be
cool too)?

My installation of Vista is just the normal RTM Vista CD from my MSDN
subscription. I setup my account as an administrator, and that's what I'm
logging in with.

Thanks again,
-- Jim

"Jim" <ji********@ngc .comwrote in message
news:15******** *************** ****@FUSE.NET.. .
>I have the following piece of code:

Directory.Creat eDirectory(myDi r);
DirectoryInfo lDir = new DirectoryInfo(m yDir);
lDir.Attributes = FileAttributes. Normal;

When this code runs, my directory is created fine, but my directory is
always read only. At first I thought it was something with using
DirectoryInfo. However, I also ran the following line of code:

Directory.Creat eDirectory(myDi r);

Immediately after running this line of code, my directory was created, and
then I went and manually tried to change the attributes of the directory
so that it was not read only. Even after I tried to set it manually, it
would always be read only. I never received back an error after I pushed
OK on the directory properties after unchecking read only, but every time
I go back to the properties of the folder it is always read only?

This is running on Windows Vista. Any ideas why?

Thanks,
-- Jim


Jul 19 '07 #2
Jim
OK,

Since this seemed like more of a Vista question, I posted this to the Vista
newsgroup. Here's the response I got there:
-----------
The read-only checkbox is irrelevant for folders. Notice it is filled in
with a square as opposed to a check, which indicates that it is NOT
checked but rather in an 'indeterminate' state.

If you are having folder access issues, it is because of the security
permissions on the folder.

The checkbox is there only so that you can easily set or clear the
read-only attribute on the files inside of that folder.
-----------

Well, I wasn't aware that there was an 'indeterminate' state. Anyway, I
think the ball is back in the .NET court. My main problem is that when I
try to call Directory.Delet e(myDir, true); on the directory, I get back an
IOException directory not empty error. All of the files in my directory are
deleted, but the directory itself is not deleted. Some thread somewhere
suggested that it was because the folder was read-only. I'm not sure if
this 'indeterminate' state is causing this IOException.

Therefore, does anybody have any idea why I can't delete this directory
entirely? All of the files in it are deleted, I just don't understand why
the debugger gets mad when it tries to delete the actual directory.

-- Jim
"Jim" <ji********@ngc .comwrote in message
news:1d******** *************** ****@FUSE.NET.. .
Well, after doing more reading, it doesn't look like this is just me.
This guy's site:
http://www.followsteph.com/2007/06/1...sta-read-only/
has several references to threads in which people cannot change the
read-only property of a folder. My Google skills are failing me to find
the answer too. Does anybody know why I can't change the read-only
property of a folder on my Vista machine (it's a temporary folder I make
in my Debug directory during debugging)? More importantly, does anybody
know how I can fix this via normal administration and via code (some
example code would be cool too)?

My installation of Vista is just the normal RTM Vista CD from my MSDN
subscription. I setup my account as an administrator, and that's what I'm
logging in with.

Thanks again,
-- Jim

"Jim" <ji********@ngc .comwrote in message
news:15******** *************** ****@FUSE.NET.. .
>>I have the following piece of code:

Directory.Crea teDirectory(myD ir);
DirectoryInf o lDir = new DirectoryInfo(m yDir);
lDir.Attribute s = FileAttributes. Normal;

When this code runs, my directory is created fine, but my directory is
always read only. At first I thought it was something with using
DirectoryInf o. However, I also ran the following line of code:

Directory.Crea teDirectory(myD ir);

Immediately after running this line of code, my directory was created,
and then I went and manually tried to change the attributes of the
directory so that it was not read only. Even after I tried to set it
manually, it would always be read only. I never received back an error
after I pushed OK on the directory properties after unchecking read only,
but every time I go back to the properties of the folder it is always
read only?

This is running on Windows Vista. Any ideas why?

Thanks,
-- Jim



Jul 19 '07 #3
sa
A directory is always shown as readonly in windows. This is nothing to
do with dotnet. This is because a directory dont have body so there is
nothing like editing a directory's content.

_______________ _________
sa@openwinforms .com
http://www.openwinforms.com/
OpenWinForms - open source windows forms and controls

Jul 19 '07 #4
Jim
OK,

Maybe it has nothing to do with anything read-only. That was just my
initial thought. My main problem is that when I try to call
Directory.Delet e(myDir, true); on the directory, I get back an IOException
directory not empty error. All of the files are deleted fine in the
directory, but the directory itself is not deleted, and I keep getting this
error.

Any other ideas?

<sa@openwinform s.comwrote in message
news:11******** *************@n 60g2000hse.goog legroups.com...
>A directory is always shown as readonly in windows. This is nothing to
do with dotnet. This is because a directory dont have body so there is
nothing like editing a directory's content.

_______________ _________
sa@openwinforms .com
http://www.openwinforms.com/
OpenWinForms - open source windows forms and controls

Jul 19 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
16663
by: o'seally | last post by:
solaris/linux admins/rookie_developers that battle with this error are probably all frustrated when it happens. i bet you're also somehow frustrated by this seemingly unsolvable error :-) ...take it easy, it'll go away once u've learned how to play around with a few things on your system and reorganised. i'm particulary a solaris junkie, but linux is my admiration. the issue here is Not the OS/Software, but rather the concept. first of all...
2
11166
by: 73blazer | last post by:
Hello, I'm writing some C++ code, and I need to be able to find the number of files in a given directory. Is it possible under AIX4.3.3 with C++ 3.6.4? I cannot seem to locate anything of this nature in the docs, aside from creating an array with 'scandir' (http://publib.boulder.ibm.com/doc_link/en_US/a_doc_lib/libs/basetrf2/scandir.htm#A12F0c9) which will also give me the number of enties in that array. This seems a little overkill. I'm...
6
8952
by: Hemant Shah | last post by:
Folks, I need to move HOME directory of an instance to another directory. What is the best way of doing it? Is changing password file enough? or dies DB2 store this info in it's own config? I am running UDB 8.2 on Linux and AIX. Thanks.
6
31753
by: gl | last post by:
I'm trying to delete a directory that contains readonly files. Is there any easy way to do this? I get a System.UnauthorizedAccessException when a read only file is encountered. Is there a way to make c# ignore a read only flag, or perhaps set the read only flag for the directory and have it apply to all files? just wondering what the standard work around to this issue was. Thanks
3
2304
by: James Coleman | last post by:
Hello, The following error is appearing when attempting to create a directory using the availale system.io methods: System.IO.DirectoryNotFoundException: Could not find a part of the path "D:\". at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.Directory.InternalCreateDirectory(String fullPath, String path) at System.IO.Directory.CreateDirectory(String path) at TestVBProject.createdirectorytest.Page_Load(Object...
4
7577
by: Jerry | last post by:
I'm having just a bit of trouble wrapping my brain around the task of working with folders that are above the site's root folder. I let users upload photos (.jpg/.gif files) which can subsequently be viewed on the site's pages. My hosting provider is requiring that any files my Web app writes get written to a folder that is above the app's root folder (for security purposes). When writing the files I understand how to use MapPath to...
5
3067
by: Verane | last post by:
Hi, I have read the thread named "Could not copy temporary files to the output directory" on this newsgroup. And I have the same symptoms on my machine. But I didn't find any solution suitable for me. (I don't use ASP.NET or any web service at all, only windows forms). Here is how I work : I have a solution with 10 projects inside. Each of them is built in a different directory (MyProject/bin/debug for each project). I have then a...
1
4989
by: Frank F | last post by:
Hi, I want to read user information from the microsoft windows 2003 server. In the windows server 2003, i've create a domain, called "wissenskolleg". I've assigned a password to it. Now, i want get access to the Active Directory with PHP. My code:
3
3199
by: Chris Mellon | last post by:
This appears to be a change in behavior from Python 2.4 to Python 2.5, which I can't find documented anywhere. It may be windows only, or related to Windows behavior. In 2.4, the current directory (os.curdir) was on sys.path. In 2.5, it appears to be the base directory of the running script. For example, if you execute the file testme.py in your current working directory, '' is on sys.path. If you execute c:\Python25\Scripts\testme.py,...
0
11279
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10981
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9673
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8047
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7205
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5893
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6085
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4725
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3323
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.