As per the Microsoft documentation, the SetFileAttributes function you can set the FILE_ATTRIBUTE_READONLY attribute on folders but the attribute it is not honored on folders.
In other words a folder that has this attribute behaves like any other folder that doesn’t have the attribute.
Does this have any purpose? Or did this have a purpose in the past?
I’m asking just out of curiosity.
>Solution :
Per the following Support article, which is linked to by the official File Attribute Constants documentation for FILE_ATTRIBUTE_READONLY:
Note Unlike the Read-only attribute for a file, the Read-only attribute for a folder is typically ignored by Windows, Windows components and accessories, and other programs. For example, you can delete, rename, and change a folder with the Read-only attribute by using Windows Explorer.
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. It has been seen where if a network share that has a large amount of folders set to Read-only, it can cause Explorer to take longer then what is expected to render the contents of that share while it waits on the retrieval of the Desktop.ini files. The slower the network connectivity to the share the longer this process can take to the point where Explorer may timeout waiting for the data and render nothing or appear to hang.
Note In some previous versions of Windows, you can change the Read-only attribute for folders by using the Properties dialog box for the folder, but no versions of Windows permit you to change the System attribute by using Windows Explorer.