Removing read only attributes on folders

G

Guest

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
 
W

Wesley Vogel

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
 
G

Guest

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, 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 said:
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
Ram said:
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
 
K

Kerry Brown

A few thoughts

1) In the error message Test Project has a space in it. In the code it
doesn't. Is this just a typo in your post?

2) Is the program running as the administrator account?

3) Are the files deleted and not the folder or is nothing deleted?

--
Kerry
MS-MVP Windows - Shell/User
www.VistaHelp.ca
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, 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 said:
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
Ram said:
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
 
W

Wesley Vogel

All Read-only means for folders is parse the desktop.ini.

I know nothing about programming.

Access denied is usually an ownership or rights problem.

HOW TO: Take Ownership of a File or Folder in Windows XP
http://support.microsoft.com/kb/308421

There may also be something in Group Policy.

Local Computer Policy\Computer Configuration\Windows Settings\Security
Settings\Local Policies\User Rights Assignment

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Ram said:
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, 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 said:
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
Ram said:
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
 
G

Guest

Hi Kerry,

1) In the error message Test Project has a space in it. In the code it
doesn't. Is this just a typo in your post? : Yes.There is no space between
testproject in either of them.

2) Is the program running as the administrator account? Yes

3) Are the files deleted and not the folder or is nothing deleted?

All the folders, and the files in those folders are being deleted. But not
files with in Testproject.In the code we are assuming Testproject as 'My
documents'.This is because we have some system files in 'My Documents'.

Testproject (folder)
-> folder f1 (deleted)
-> folder f2 and files a1,a1 in f2 (deleted)
-> file b1, b2 in Testproject (Not being deleted)


Hi Wesley,

All the settings in 'User Rights Assignment' of local security policy are
default and the machine is in work group.

Regards
Ram
 
D

David Schrader

Odd as it may sound, there ARE ways of changing
all of the Folder (which IS a File) attributes including
the "read" attribute.

Unfortunately Microsoft has *never* seen fit make
the effort of implementing that level of file (sic)
security/operability/functionality. I had hoped,
when they implemented the NTFS system that
their "vision" might include that foresight. Sadly
their scope wasn't quite that visionary.

It would be nice to be able to place an ACL on
any Drive/Directory/Sub-Directory/File/or/
File.Version and know that it would work.

Another AC that would be nice to have would
be an (E)xecute "control" that was independent
from the current "ReadExecute" option. That way
you could allow people (E)xecute access without
giving then (R)ead/Copy access.

Just a couple of passing thoughts - worth less
than a "penny for my thoughts."

David
 
W

Wesley Vogel

Odd as it may sound, there ARE ways of changing
all of the Folder (which IS a File) attributes including
the "read" attribute.

Which will break special folders!

Most folders are NOT Read-only.

Special folders (I.e. Cookies, Control Panel, Desktop, Downloaded Program
Files, Favorites, Fonts, History, My Documents, My Music, My Pictures, My
Videos, Recycle Bin, Shared Documents, Shared Music, Shared Pictures, Shared
Videos, SendTo, Start Menu, Startup, Temporary Internet Files, etc.) need to
have the System or Read-only (parse the desktop.ini) attributes set, or they
become regular folders.

[[The Read-only and System attributes is only used by Windows Explorer to
determine whether the folder is a special folder, such as a system folder
that has its view customized by Windows (for example, My Documents,
Favorites, Fonts, Downloaded Program Files), or a folder that you customized
by using the Customize tab of the folder's Properties dialog box. As a
result, Windows Explorer does not allow you to view or change the Read-only
or System attributes of folders. When a folder has the Read-Only attribute
set it causes Explorer to request the Desktop.ini of that folder to see if
any special folder settings need to be set. ]]

[[Warning If you remove the Read-only or System attribute from a folder,
it may appear as a ordinary folder and some customizations may be lost. For
example, Windows customizes the Fonts folder and provides a special folder
view that permits you to hide variations, such as bold and italic. It also
permits you to change the folder's view settings in ways that are specific
to fonts. If you remove the Read-only and System attributes of the Fonts
folder, these customized view settings are not available. For folders that
you have customized by using the Customize tab of the folder's Properties
dialog box, the folder icon and other customizations may be lost when
you remove the Read-only attribute. ]]

[[The Read-only check box for folders is not available because it does not
apply to the folder. You can use this check box to set the Read-only
attribute for files in the folder. However, you cannot use Windows Explorer
to determine if a folder has the Read-only and System attributes set. ]]
from...
You Cannot View or Change the Read-Only or System Attribute of Folders
http://support.microsoft.com/kb/326549

Microsoft's Grammar Checker must have been broken that day.

According to David Candy, Microsoft, back in the Windows 95 days, used an
unused attribute called Read-only for folders. This attribute does not mean
Read-only for folders, it means parse the desktop.ini.

[[The difference between a folder and a file is that the directory attribute
is set on the file to make it a directory (likewise a volume label is a zero
byte file with the volume attribute set.

A better way of looking at it is that it's a meaningless attribute, and
always has been. Because it is meaningless MS used it when 95/NT4 was
released to do other tasks.

That particular bit prior to NT4/95
Means Read Only on a file and means nothing on a folder.
After 95/NT4
Means read only on a file, and as directories CAN'T be read only, by design,
the space used could be reused for other purposes - and was so used for
parsing a desktop.ini.

If you can't understand that then change your thinking to
There is no such attribute called read only on a folder, only Parse the
desktop.ini.

The only attribute that is traditionally applied to folders is Hidden (and
of
course directory) - all other are free to be reused and Read Only and System
were - the difference between the two is you may get a message when trying
to delete a system folder (which can be suppressed by a desktop.ini setting)
saying "This is a System folder - sure you want to delete". Apart from that
they have identical meanings - no meaning before 95 and parse the
desktop.ini 95 and later. ]]
From David Candy
http://groups.google.com/group/micr...cc87ab178b12?lnk=st&q=insubject:read+insubjec
t%3Aonly+author%3Adavid+author%3Acandy&rnum=3&hl=en#c3b9cc87ab178b12

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
M

Michael Bednarek

Odd as it may sound, there ARE ways of changing
all of the Folder (which IS a File) attributes including
the "read" attribute.

Which will break special folders!

Most folders are NOT Read-only. [snip]
[[The Read-only and System attributes is only used by Windows Explorer to
determine whether the folder is a special folder, such as a system folder
that has its view customized by Windows [snip]
If you can't understand that then change your thinking to
There is no such attribute called read only on a folder, only Parse the
desktop.ini.
[snip]

At the file level, there does indeed exist such an attribute called Read
Only for directories, and it can be set/unset, although MS's CLIs can't.
It has no practical meaning except, as you describe, for Explorer.exe,
but saying "there is no such attribute" is not correct.
 
W

Wesley Vogel

I happen to agree with David Candy.

Shpx lbh!

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
Michael Bednarek said:
Odd as it may sound, there ARE ways of changing
all of the Folder (which IS a File) attributes including
the "read" attribute.

Which will break special folders!

Most folders are NOT Read-only. [snip]
[[The Read-only and System attributes is only used by Windows Explorer to
determine whether the folder is a special folder, such as a system folder
that has its view customized by Windows [snip]
If you can't understand that then change your thinking to
There is no such attribute called read only on a folder, only Parse the
desktop.ini.
[snip]

At the file level, there does indeed exist such an attribute called Read
Only for directories, and it can be set/unset, although MS's CLIs can't.
It has no practical meaning except, as you describe, for Explorer.exe,
but saying "there is no such attribute" is not correct.
 
M

Michael Bednarek

I happen to agree with David Candy.

It's not a matter of opinion. The Read Only attribute for directories
exists. Saying "there is no such attribute" is wrong.
Shpx lbh!

What brought that on??? Got up on the wrong side of the bed?
 
W

Wesley Vogel

The ROT13 part. (e-mail address removed) I was checking if you were awake. ;-)

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
M

Michael Bednarek

The ROT13 part. (e-mail address removed) I was checking if you were awake. ;-)

I would have preferred a less offensive check. No smiley here.

Speaking of preferences: I would also prefer if you would place your
signature at the end of messages and remove the signature from previous
messages in your follow-up. Together with your habit of top-posting, it
makes follow-ups to your messages quite difficult.
 
G

Guest

Hi, im havig this problem: Im trying to save all my pics to a dvd for
safe storage (approx 3.5 gigs worth). problem copying box pops up, says
,windows encountered a problem when trying to copy this file. what do you
want to do ? retry cancel.
I was told to remove the read only attrib and did (for the files inside the
folders) I was told the folder attrib didnt matter and I get that part. But
still cannot copy the files individually or as folders.I have gone into
Registry Editor, as told here http://support.microsoft.com/kb/256614/EN-US/
Article 256614 Revis 5.1. Having trouble with number 7 on the list here it
is; 7. After you make this change to the registry, you must change the
Read-Only attribute for all affected folders by using the attrib command at a
command prompt (Command.com or Cmd.exe). Type attrib /? at the command prompt
to view the syntax for the attrib command. For example, to change the
Read-Only attribute to System for the C:\Test folder, use the following
command:
attrib -r +s c:\test mine would be, attrib -r +s c:\all pics I do
that, and get message, parameter format not correct, what am i doing wrong
please help. I have been researching for awhile and notice this sort of
problem alot but not the last part of the ? So now I ask for anybodys help
please. All of my pictures of familly is on it and I dont want to lose them
thanks for your time. thanks Ray Jr
 
S

Steven L Umbach

I have never seen such a problem in that the read only attribute would not
allow a copy operation. A couple things I would try though is to copy those
files to another folder on your computer and then try to copy them to the
DVD to see if that makes a difference or not. Try copying just a few of them
to see if that works or not. Try making a zip file out of them and then copy
that. If all else fails try using the built in ntbackup to back the files up
to large backup file and then try to copy that to the DVD. If you try using
the zip file or ntbakup do a dry run of restoring them to make sure it all
works a expected. I also like using Norton Ghost to make image type backups
and Norton lets you view and extract files from an image.

Steve

http://www.microsoft.com/windowsxp/using/setup/learnmore/bott_03july14.mspx
-- ntbackup
 
G

Guest

I tried what was suggested (except norton ghost) and nothing yet. I am having
similar problem when trying to copy music to my sd too, it says the media is
write protectd remove write protection? I am at a loss, maybe ill have to
shell out the $35 bucks to microsoft support and see if they can help, but
ive spent so much time on this and gotten so close I hate to give up (beside
the fact of what ive learned) I am starting to think its something right iin
front of my face just cant find it yet. Ill hold out a little longer maybe
someone who had this problem fixed can help thanks for the suggestion
Steve.--
thanks Ray Jr
 
S

Steven L Umbach

Did you try using other software such as that which may have come with the
DVD burner and also try logging on as an administrator if you are not as I
have heard of some cases where users had problems burning to CD/DVD when not
logged on as a local administrator? You can use the command net localgroup
administrators to see what users are members of the administrators group.
Also use services.msc to make sure that the Imap CD Burning service is
configured with startup type manual or automatic and not disabled and if it
is automatic it should be started. If it is set to manual try to start it to
see if that helps. It may also help to look in the logs via Event Viewer to
see if any warning/error messages are shown time stamped when you have a
problem that may give a clue as to what is going on.

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top