How to make a folder read-only in Windows?

So I want to prevent myself writing into some files into folder. I always works with back_up folders in which I compare, transfer data to target projects. The problem is that sometimes on mistake I edit the Back-Up files. Is there any way I can deny the edit/write permission for myself? I don't want files to be renamed/deleted. Setting the folder read only flag is something that does absolutely nothing - after that I can edit/delete files with no problem again (at least in Win 8.1). This is very important for me - because for now I've corrupted many back_up files that way and this give me a lot of trouble. Any ideas?

I'm running latest version of Windows 8.1 x64.


Solution 1:

Original answer:

If it's NTFS, you can use the file system security feature.

  1. Edit the folder's "security" tab, I'm assuming you didn't change them before: delete "authenticated users", it may warn you that you must disable inheritance first, do so in the "advance" option.

  2. Make sure UAC is on.

Now when you try to edit/add/delete anything inside that folder, UAC will warn you, you can even set it to higher level that you must enter your password every time.

Edit: The above method is a fool-proof easy guide, which only apply to Windows Vista+ and require admin rights, and untempered file/folder security settings to start with.

However if you understand the principle behind, you can do this on nearly any Windows version with NTFS, on any user account.

Assume your normal working account is A, and another "safe" account is B, you can set the folder owner to B and give full privilege to it (don't forget to check "replace all child object permissions with inheritable permissions from this object"), then add account A as read-only, and now you can only write to it with account B, while still read/use it in the daily account A.

Without administrator rights, you cannot remove administrator from the access list, nor change the owner if it was administrator. But the method should work anyway, also if you create the folder, the owner should be default to you.

PS. All above are based on my experience, welcome to advice if you have better method.

Solution 2:

Romeo is correct, you can make your individual files read-only that way through the properties, but you won't be able to protect it from deletion.

A further suggestion, if you'd like to quickly change multiple files to read only.

Open up a command prompt and enter the command attrib +r [path] taking advantage of the wildcard *