Re: Removing read only attributes on folders



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


.



Relevant Pages

  • files still missing
    ... As well as that I have somehow lost the contents of two ... also lost one or two other folders completely. ... I installed outlook express three times and each time it ... drives can and do get what ever information is on a ...
    (microsoft.public.windowsxp.accessibility)
  • lost files
    ... As well as that I have somehow lost the contents of two ... also lost one or two other folders completely. ... I installed outlook express three times and each time it ... drives can and do get what ever information is on a ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Warning: DBXpress recovery program
    ... folders to be lost if you interrupt the compacting process. ... OE6 gives you the option to "Cancel" the compacting process at any time ... I spent days emailing you and helping you trying to recover your messages that YOU lost and blame Microsoft for. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: PS Re: HELP...Elves must have messed up my OE during the night
    ... I think all your messages are likely there, but you are going to have to do a bit of searching and stuff to get them back. ... OE most likely lost the principal Identity you were using, which is why the message rules are toast, and can't find the folders. ... That should let you find dbx files. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • missing files
    ... pictures folder, approximately 1000 jpeg's. ... As well as that I have somehow lost the contents of two ... also lost one or two other folders completely. ... I installed outlook express three times and each time it ...
    (microsoft.public.windowsxp.accessibility)