Re: Removing read only attributes on folders
- From: Ram <Ram@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 24 Jul 2006 22:59:02 -0700
Hi Wesley,
As part of our requirement, we are needed to delete all the folders and
files from ‘My documents’ folder after each exit of our application. But we
are facing the below error .
“Access to the path 'C: \Documents and Settings\Administrator\My
Documents\Test Project' is denied.”
This is the VB.net code we are trying to implement. Please suggest on the
same.
Regards
Ram
---------------------------------------------------------------------------------------------
string strPath = "C:\\Documents and Settings\\Administrator\\My
Documents\\TestProject";
string[] s =System.IO.Directory.GetDirectories(strPath);
try
{
for (int i = 0; i < Convert.ToInt32(s.Length); i++)
{
System.IO.Directory.Delete(s[i], true);
}
}
catch (IOException ex)
{
MessageBox.Show(ex.ToString());
}
string strPath1 = "C:\\Documents and Settings\\Administrator\\My
Documents\\TestProject";
System.IO.File.Delete(strPath1);
-------------------------------------------------------------------------------------------
"Wesley Vogel" wrote:
Folders cannot be read-only, only files can be read-only..
Folder Read-only attribute
[[Specifies whether the files in this folder are read-only, which means that
they cannot be changed or accidentally deleted.
For multiple folders, if you select this check box all of the files in the
folders will be read-only. If you clear the check box, none of the files in
the selected folders will be read-only.]]
The Read-only attribute that you see in folder Properties has nothing to do
with any of the folders themselves.
There is nothing to remove.
If you keep messing around you'll be back asking; One of my special folders
(e.g. My Documents) has lost its name, lost its icon, or has the wrong Task
Pane template, how can I get it back?
--
Hope this helps. Let us know.
Wes
MS-MVP Windows Shell/User
In news:E1364D37-5C34-439E-8EA7-CDF852824CD5@xxxxxxxxxxxxx,
Ram <Ram@xxxxxxxxxxxxxxxxxxxxxxxxx> hunted and pecked:
Hi,
Though I was able to change the file attributes, I was unable to change
the folder attributes through the below command.Please suggest on this.
attrib -r -s "C:\Documents and Settings\ITQA\My Documents\*" /s /d
Regards
Ram
- Follow-Ups:
- Re: Removing read only attributes on folders
- From: Wesley Vogel
- Re: Removing read only attributes on folders
- From: Kerry Brown
- Re: Removing read only attributes on folders
- References:
- Re: Removing read only attributes on folders
- From: Wesley Vogel
- Re: Removing read only attributes on folders
- Prev by Date: Re: local groups and NTFS Persmissions
- Next by Date: Re: deleting local user ...
- Previous by thread: Re: Removing read only attributes on folders
- Next by thread: Re: Removing read only attributes on folders
- Index(es):
Relevant Pages
|