Protect Files and Folders Deletion Windows 10
To protect files and folders from deletion in Windows 10, you can use built-in features like Read-only attributes, NTFS permissions, and File Explorer’s hidden-item option, or third-party tools that add password protection. The most reliable method is setting NTFS permissions to deny delete access for specific users or groups, which works even if the user has administrative rights (with some caveats). This article explains each method, its strengths and weaknesses, and how to choose the right one for your situation.
Why Files Get Deleted Accidentally
Accidental deletion is one of the most common causes of data loss on Windows 10. It happens when you:
- Press Shift+Delete, which bypasses the Recycle Bin.
- Select a file and press Delete out of habit, then empty the Recycle Bin.
- Run a cleanup tool (like Disk Cleanup) that removes files you didn’t intend to remove.
- Have a script or program that deletes files based on a pattern, and it matches the wrong files.
Once a file is permanently deleted from the Recycle Bin, it’s not immediately gone from the disk—it’s just marked as free space. But recovering it requires specialized software and is not guaranteed. Prevention is far easier than recovery.
Method 1: Set the Read-Only Attribute
The simplest way to prevent deletion is to mark a file as Read-only. Right-click the file, select Properties, check the Read-only box, and click OK. This works for individual files, but not for folders—Windows 10 does not allow you to set a folder as read-only to prevent deletion; the read-only attribute on a folder only affects the files inside it, and even then, it’s a weak protection because many programs (and even File Explorer) can still delete read-only files with a confirmation prompt.
To apply read-only to all files inside a folder, you can use the command line:
- Open Command Prompt as administrator.
- Type
attrib +r "C:\Path\To\Folder\*.*" /sand press Enter.
This sets the read-only attribute on every file in that folder and subfolders. However, this does not prevent the folder itself from being deleted, and it does not stop a determined user or program from removing the attribute first.
Method 2: Change NTFS Permissions
NTFS permissions are the most robust built-in protection. They allow you to specify exactly who can read, write, modify, or delete a file or folder. Here’s how to deny delete permission for a specific user or group:
- Right-click the file or folder, select Properties, then go to the Security tab.
- Click Advanced, then Disable inheritance (if needed) and choose Convert inherited permissions into explicit permissions.
- Click Add, then Select a principal. Enter Everyone (or a specific username) and click OK.
- In the Permission Entry window, set Type to Deny.
- Check the box for Delete subfolders and files and Delete.
- Click OK on all windows.
Now, any user (including administrators, unless they take ownership) will get an “Access Denied� error when trying to delete the file or folder. This method works for folders and files, and it’s the same technique used in corporate environments to protect critical data.
Important caveats:
- Administrators can take ownership and change permissions, so this is not absolute protection against a malicious admin.
- If the disk is formatted as FAT32 or exFAT, NTFS permissions are not available.
- If you deny delete to Everyone, you also deny it to yourself, so you’ll need to temporarily change permissions when you want to delete the file.
Method 3: Hide Files and Folders
Hiding files doesn’t prevent deletion, but it reduces the chance of accidental deletion because the files are not visible in File Explorer. To hide a file or folder:
- Right-click the item, select Properties.
- Check the Hidden box and click OK.
- To make hidden items invisible, open File Explorer, go to the View tab, and uncheck Hidden items.
This is a low-effort deterrent, but anyone who enables “Hidden items� will see the files. It’s not a security measure—it’s just a way to keep your desktop or folders tidy.
Method 4: Use File History or Backup
The best protection against deletion is a backup. Windows 10 includes File History, which automatically backs up files in your Libraries, Desktop, Contacts, and Favorites to an external drive or network location. To set it up:
- Go to Settings > Update & Security > Backup.
- Click Add a drive and select an external drive.
- Turn on Automatically back up my files.
File History keeps versions of files, so you can restore a file even after it’s been deleted. It’s not a prevention method, but it’s the most reliable recovery method. For folders outside your Libraries, you can add them by going to More options and selecting Back up these folders.
Alternatively, you can use System Protection (also known as Previous Versions) if you have System Restore enabled. Right-click a folder, select Properties, go to the Previous Versions tab, and you may see older copies of the folder that you can restore.
Method 5: Third-Party File Locking Software
If you need password protection or more granular control, third-party tools like Folder Lock, Wise Folder Hider, or My Lockbox can hide and lock folders with a password. These tools work by intercepting file system requests and denying access without the password. They are useful for privacy, but they are not foolproof—some can be bypassed by booting into another OS or using a Linux live USB. Also, they are not free (or have limited free versions), and they may conflict with Windows updates.
When choosing a third-party tool, look for one that:
- Supports NTFS and exFAT drives.
- Has a portable version (if you need to use it on multiple PCs).
- Is regularly updated for Windows 10 compatibility.
Common Mistakes and Misconceptions
One common misconception is that setting a file to “Read-only� prevents deletion. As mentioned, it does not—Windows only shows a warning, and the user can confirm the deletion. Another mistake is using the Hidden attribute as a security measure; it’s trivial to unhide.
Another frequent error is applying NTFS deny permissions incorrectly. For example, if you deny Delete but not Delete subfolders and files, a user can still delete the folder if it contains subfolders. Also, if you deny Modify permission, the user can’t even open the file, which might be too restrictive.
Finally, many users forget that NTFS permissions do not apply to files on FAT32 or exFAT drives (like most USB flash drives). If you need to protect files on a USB drive, you’ll need to use encryption or third-party software.
How to Choose the Right Method
Your choice depends on your threat model:
- Accidental deletion by yourself: Use File History or a backup solution. It’s the easiest and doesn’t lock you out.
- Other users on the same PC: NTFS permissions are the best built-in option. Deny delete for the specific user accounts.
- Privacy from others: Use third-party folder locking software or BitLocker (for whole-drive encryption).
- Protection from malware: NTFS permissions can help, but malware running as admin can change them. A backup is your best defense.
For most home users, a combination of File History and NTFS permissions on sensitive folders is sufficient. For business environments, group policies can enforce these settings across many computers.
Frequently Asked Questions
Can I prevent a file from being deleted by an administrator?
No, not absolutely. An administrator can take ownership of any file and change permissions, even if you deny delete to Everyone. However, you can make it more difficult by denying delete to the Administrators group, but the admin can still reset permissions. The only way to prevent an admin from deleting a file is to store it on a write-protected medium (like a CD-R) or use a separate account with no admin rights for daily use.
Does the Recycle Bin protect against deletion?
Only if the file is deleted normally (without Shift+Delete). Files deleted with Shift+Delete bypass the Recycle Bin. Also, files deleted from a network drive or a USB drive are not sent to the Recycle Bin. Always check if your file is in the Recycle Bin before attempting recovery.
How do I protect a folder on an external drive?
If the drive is NTFS, you can use NTFS permissions. If it’s FAT32 or exFAT, you cannot use permissions. In that case, use third-party software that encrypts or locks the folder, or use BitLocker To Go (available in Pro/Enterprise editions) to encrypt the entire drive.
Will setting a folder to Read-only prevent me from adding new files?
No, the Read-only attribute on a folder does not prevent adding new files. It only affects the files inside the folder, and even then, it only marks them as read-only. To prevent adding new files, you need to deny “Write� permission in NTFS permissions.
Can I password-protect a folder without third-party software?
No, Windows 10 does not have a built-in feature to password-protect a folder. You can use NTFS permissions to restrict access, but that doesn’t require a password—it’s tied to user accounts. For a password prompt, you need third-party software or create an encrypted archive (like a ZIP file with a password) using tools like 7-Zip.
What is the difference between “Delete� and “Delete subfolders and files� in NTFS permissions?
“Delete� allows or denies deleting the file or folder itself. “Delete subfolders and files� allows or denies deleting the contents of a folder, even if the user doesn’t have “Delete� permission on the folder. To fully protect a folder, deny both.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.