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 4 11822
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
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
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
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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...
|
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'...
|
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.
|
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...
|
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...
| |
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...
|
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...
|
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:
|
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...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
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. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |