3 Ways: How to Prevent Files from Being Renamed/Deleted in Windows
Regardless of what you use your computer for, there may be files on your computer that you don't want anyone to rename or delete. But unfortunately, the way Windows works doesn't actually have a default mechanism to help you prevent files from being deleted on your computer. Anyone with access to your computer can find your files and modify, rename, and even delete them from your computer. Although Windows doesn't protect your files by default, it does offer an option to help protect your files from any deletion attempts. In fact, there are various built-in methods and third-party file protection tools that can help prevent your files from being modified on your computer. If you have deleted an important file, the best solution may be to try to recover it using a third-party program. However, it's better to be safe than sorry, so the right thing to do is to protect your files from deletion in the first place. To prevent this, you need to protect your files. Read on to learn the best ways to protect Windows 10 files from being deleted, re-edited, or renamed.
Method 1: Protect Files and Folders by Changing Default Option
Step 1: Right-click the file, select Properties.
Step 2: In the Properties window, under the Security tab, click the "Advanced" button.

Step 3: Open the Advanced Security Settings window, which will let the user define permissions for the selected files. Click Disable inheritance to modify file permissions.

Step 4: Select "Convert inherited permissions to explicit permissions for this object."

Step 5: Your user account will be listed on your screen. Select your account and click the edit button below.
Step 6: Click Show Advanced Privileges to display all available privileges. There is also a Type drop-down menu, select Deny.
Step 7: Then tick the following options.
Delete
Read permission
Change permissions
Take ownership
Click OK to save the changes.

Method 2: Protect Files from Being Renamed/Deleted with File Protection Tool
Windows doesn't have an easy option that lets you prevent files from being deleted, which can be a big problem. However, there are some "other" ways to protect your files from deletion in Windows. You can use a third-party program specially designed to prevent deletion and renaming - IUWEsoft Password Protect Folder Pro, which can completely lock, hide or disguise all important files, folders and drives.
3 Steps to Lock Files from Being Renamed/Deleted in Windows 11/10/8.1/8/7/XP/Vista
Step 1: Download, install and launch the File Protection Tool on your computer. Click "Lock File/Folder", and then click "Open for Lock" button to select a file or folder from computer or external drive.


Step 2: Select lock type (Lock without Hidden or Lock with Hidden), input and confirm password and then click Lock button to prevent files from being renamed/deleted in Windows.


Method 3: Protect Files from Being Renamed/Deleted by Hiding
Hidden files will not appear in File Explorer, so no one has a chance to rename or delete your files.
Step 1: Right-click on the file you want to protect, select Properties.
Step 2: Under the default General tab, you will see properties with two options. Check the hidden option.
Step 3: Click OK to verify the changes and your file is now hidden.

Note: Once you hide a file, not only other people, but yourself can't see the hidden file. So if you need to edit hidden files, you should disable the hidden condition first.
How to view hidden files
Step 1: Open File Explorer on your PC.
Step 2: Click the View tab at the top of the window. Go to Options > Change folder and search options.
Step 3: Click the View tab in the newly opened dialog. In Advanced settings, find Hidden files and folders, select Show hidden files, folders and drives.
Step 4: Click OK to save all changes. Now you should see all hidden files reappear.