Make Files or Folders Undeletable in Windows 10
In this article
This guide shows you how to protect important files or folders from being accidentally or intentionally deleted in Windows 10. You'll learn two built-in methods: using Read-only attributes and using advanced permissions. No third-party software is needed.
What You'll Need
- A Windows 10 PC with an administrator account (for the permissions method).
- The file or folder you want to protect.
- Basic familiarity with right-clicking and navigating file properties.
Step-by-Step
Method 1: Using the Read-only Attribute (Files Only)
- Locate the file you want to protect in File Explorer.
- Right-click the file and select Properties.
- In the General tab, under Attributes, check the box next to Read-only.
- Click Apply and then OK.
- When you try to delete the file, Windows will ask for confirmation. If you confirm, the file is still deleted. This method only adds a warning, not full protection. For full protection, use Method 2.
Method 2: Using Advanced Permissions (Files and Folders)
- Right-click the file or folder you want to protect and select Properties.
- Go to the Security tab.
- Click the Advanced button at the bottom right.
- In the Advanced Security Settings window, click Disable inheritance (if it's enabled).
- Choose Convert inherited permissions into explicit permissions on this object.
- Now, in the Permission entries list, select each entry (e.g., Authenticated Users, SYSTEM, Administrators) and click Edit.
- In the Permission Entry window, uncheck the Delete and Delete subfolders and files boxes (under Basic permissions). Also uncheck Full control if it's checked, because full control includes delete.
- Click OK to close each window.
- When you're back at the Advanced Security Settings window, click Apply and then OK.
- Test by trying to delete the file or folder. You should get an error saying you need permission.
Common Mistakes
- Only setting Read-only on a folder: The Read-only attribute on a folder does not prevent deletion; it only affects files inside it. Use the permissions method for folders.
- Removing all permissions: If you deny yourself all permissions, you might lock yourself out of the file. Always keep at least Read & execute and List folder contents for yourself.
- Forgetting to disable inheritance: If you don't disable inheritance, parent folder permissions can override your changes, and the file may still be deletable.
- Not applying to subfolders: If you protect a folder but want to protect everything inside it, you need to replace permissions on child objects. In the Advanced Security Settings window, check the box Replace all child object permission entries before clicking OK.
Tips
- Use a dedicated folder: Create a folder like
C:\Protectedand apply the permissions there. This keeps your protection organized. - Keep an administrator account: Even with permissions, an administrator can take ownership and change permissions. This method protects against accidental deletion, not against a determined admin.
- Backup regularly: Protection is not a backup. Keep copies of important files elsewhere (external drive, cloud).
- Use File History: Windows 10's File History can restore previous versions of files, which is a safety net if something gets deleted despite protection.
- Test after applying: Always try to delete the file after changing permissions to confirm it's actually protected.
Troubleshooting
I can still delete the file after setting permissions.
Check that you removed Delete for every permission entry, including SYSTEM and Administrators. Also ensure that inheritance is disabled. If you're testing as an administrator, remember that admins can override permissions by taking ownership.
I get an access denied error when trying to open the file.
You likely removed too many permissions. Go back to Properties > Security > Advanced and edit the entry for your user account to add Read & execute and Read permissions.
I can't change permissions because I'm not the owner.
Right-click the file, go to Properties > Security > Advanced, and click Change next to Owner. Enter your username, click Check Names, then OK. After taking ownership, you can modify permissions.
The folder is protected but new files inside it are not.
New files inherit permissions from the parent folder. If the parent folder's permissions allow deletion, new files will too. Apply the protection to the parent folder and replace child permissions as described in the tips.
I want to undo the protection.
Go back to Advanced Security Settings, check Allow inheritable permissions from parent to propagate, and then remove any explicit deny entries. Or simply reset permissions by clicking Restore defaults (if available).
Frequently Asked Questions
Can I make a file undeletable without using permissions?
No, the Read-only attribute only gives a warning. The only built-in way to truly prevent deletion is to modify permissions, which requires an administrator account.
Will this work on a USB drive or external hard drive?
Yes, if the drive is formatted with NTFS. FAT32 and exFAT do not support Windows permissions, so the methods above won't work on those drives.
Can a virus or malware delete a protected file?
If the malware runs with administrator privileges, it can take ownership and change permissions. Protection is not a substitute for antivirus software.
Does this prevent renaming the file?
No, renaming is a different permission (Write Attributes). To prevent renaming, you'd need to remove the Write Attributes and Write Extended Attributes permissions as well.
What if I forget the password for the administrator account?
You won't be able to change permissions without an admin account. You may need to use a password reset disk or another admin account to regain access.
Is there a way to make a file undeletable using Command Prompt?
Yes, you can use the icacls command to modify permissions. For example, icacls "C:\path\file.txt" /deny "*S-1-1-0":(DE) denies delete to Everyone. However, this is more advanced and the GUI method is safer for most users.