8

I know other people have asked this before, but none of the suggested solutions work. I think this is blocking me write access to a folder using java (not sure though). No matter what I do the box is always checked on every folder on every drive on my computer. I have tried unchecking it, unchecking it and saying yes to 'Apply to this folder and all subfolders...', I have run the 'attrib -r +s ' command and the 'takeown /f [path to folder] /r /d y' and 'icacls [path to folder] /grant administrators:F /T' commands. Neither made any difference.

I have rebooted and I have made sure the folder I'm trying this on has had full control permissions for my user, administrator and all users.

Any help here would be greatly appreciated.

Also note these files/folders are not actually read only for any other application including windows explorer. It's only java which is having a problem and that mightn't even be related.

enter image description here enter image description here

OneTwo
  • 299
  • 2
  • 3
  • 7
  • Try running the app as administrator, or, writing to a folder that is NOT at the root drive (C:). The root C: is protected by UAC. – rrirower Feb 23 '15 at 13:33
  • 2
    Regarding the first screenshot: http://superuser.com/questions/866120/cant-remove-read-only-attribute-from-folder-windows-8-1/866147#866147 – Dawn Benton Apr 25 '15 at 14:18
  • In "'attrib -r +s", why +s? That would seem to make it a system file/folder. – Brian Carlton Feb 20 '17 at 17:38

2 Answers2

4

You really can't unset Read-only attribute on any folder in Explorer: Explorer always shows Read-only attribute in indeterminate state (starting from Windows 7, if I remember correctly). Yet attrib will tell you whether Read-only attribute is set or not.

Read-only attribute on a folder does not affect whether a user can modify its contents or not. However, Read-only attribute is a special attribute for Explorer. If Read-only attribute is set, Explorer will search for desktop.ini inside the folder and loads it. For example, this way Documents, Pictures and other folder are localized in your user profile.


If the folder is writable using Explorer or Command Prompt, then you have access to write to that folder.

Can't any Java application write to the specified folder?
Is it only one Java app that can't?

So the problem is somewhere in the Java app.

For example, Java Web Start (JWS) apps can be executed in a sandbox which blocks the app from accessing arbitrary files and folders on the file system.

Without more details about the application, it's hard to guess why it can't write to this folder.

Alexey Ivanov
  • 4,349
  • 4
  • 26
  • 59
  • 1
    Sorry, but what an actual f\*ck does this "Read-only" even mean then?! What the f\*cking nonsense ... – Artfaith Dec 09 '20 at 21:59
  • @F8ER _Read-only_ attribute makes a file read-only: you cannot write to it unless you clear the attribute. Yet it has no effect on folders / directories. – Alexey Ivanov Dec 10 '20 at 11:13
  • `@Alexey Ivanov` ... and the water is transparent. I'm not telling you about the read-only purpose, but the purpose having it on the directory which doesn't mean it's read-only because you can rename it and change internals. – Artfaith Dec 11 '20 at 01:43
  • @F8ER I guess it's just for historical reasons… It might have had effect on folders in the old days of MS DOS. It is exactly for this reason that you cannot see in Windows Explorer whether _Read-Only_ attribute is set on a folder or not. – Alexey Ivanov Dec 11 '20 at 20:09
  • Oh this is such a mess. Utter confusing. As far as I know, these "half-checked" Read-only folder attributes appeared after I installed Windows 11. Now, after the upgrade, I have to be administrator to even move files or rename files within my non-system drive D: ... – Henrik Sep 18 '22 at 20:02
  • @Henrik This has nothing to do with the read-only attribute, it's ignored. The permissions on the Security tab are not. Check the permissions on the folders, make yourself the owner of the folders and all subfolders and files or modify the permissions so that you have full access. – Alexey Ivanov Sep 22 '22 at 15:06
1

Microsoft explains all at this link.

Basically when viewing folders in Windows explorer the READ ONLY ATTRIBUTE is ignored at folder level. It is only applied at File level. you can check this by going into one of your READ ONLY folders and checking the properties on a file that is not read only. If your file is currently set to READ ONLY you will find that at folder level you can clear the READ ONLY attribute and it will stay that way when click APPLY.

BTW this is not the same as an issue I had with Scandisk USB stick where all my folders set themselves to READ ONLY and came up with a WRITE PROTECT message when I tried to write to it. Apparently when a Scandisk USB sticks detect an error it defaults to Write Protect mode. Scandisk will replace the stick if it is less the 5 years old, but you have to send your stick back to them. In my cae I cannot as I work on confidecntila patent information that was on the stick. So my advice in this case would be to avoid UAB sticks that default to Write Protect when they detect an internal error. Preferably find one with manual write protect switch (not easy!). The work round if you have this is isue is to copy the "READ ONLY" files to a new folder on your hardrive and then unset REAd ONLY attricbute to the the new folder and subfolders. Then even if the folders show READ ONLY you will be able to read from and write to the files at file level as outlined above.

logikman
  • 11
  • 1