How to create a folder or file that cannot be deleted in Windows 10

Explorer's standard Delete option won't work for your protected folders or files.

Windows 10 has a Recycle Bin to protect against accidental data deletion. However, users can still delete folders and files that they don't know they have accidentally chosen to delete by emptying that Recycle Bin. Therefore, the Recycle Bin is not a completely proof-of-concept safeguard for accidental data loss.

However, you can make a folder or file undeletable in Windows so that it never ends up in the Recycle Bin. Then Explorer's standard Delete option won't work for your protected folders or files. This is how you can create a folder or file that cannot be deleted in Windows 10.

How to create a folder or file that cannot be deleted by modifying its permissions

This first method allows you to make both a folder and a single file undeletable. It involves denying all permissions to a folder or file so that the user cannot delete it. Here are the steps to make a folder or file undeletable by modifying permissions:

1. First, click the File Explorer shortcut on the taskbar and display the folder that includes the folder or file you want that cannot be deleted.

2. Right click on the folder or file and select Properties .

3. Click Security in the file or folder properties window.

4. Click the Edit button on the Security tab .

How to create a folder or file that cannot be deleted in Windows 10 Picture 1How to create a folder or file that cannot be deleted in Windows 10 Picture 1

 

5. Select SYSTEM in the Group or user names box .

6. Click the Deny check box for the Full Control setting , which will also check all the other boxes below it.

How to create a folder or file that cannot be deleted in Windows 10 Picture 2How to create a folder or file that cannot be deleted in Windows 10 Picture 2

7. Repeat the previous two steps for all accounts shown in the Group or user names box . After that, permission will be denied for all usernames.

8. Select the Apply option of the permissions window.

9. Click Yes to confirm you want to deny permission.

10. Then click OK in the permissions and properties window.

Now, try to delete the folder or file you just created that cannot be deleted. Right click on the folder or file and select Delete . The Folder Access Denied window with the Continue option will appear. Clicking Continue will bring up another window with a Try Again button . Selecting Try Again will never delete the file or folder.

How to create a folder or file that cannot be deleted in Windows 10 Picture 3How to create a folder or file that cannot be deleted in Windows 10 Picture 3

 

However, you cannot open or edit any folders or files that cannot be deleted in this way. If you want to open or edit a folder or file that can't be deleted, you'll need to undo all permission changes you've made. Display the permissions window for the file or folder, as outlined in steps 1 to 4 above, and then clear all Deny checkboxes to gain access again.

How to create a folder that cannot be deleted with Command Prompt

You can set up a new undeletable folder with the reserved Windows keyword by executing the CMD command. Since that folder will have a reserved keyword name, you won't be able to delete it in File Explorer. Here's how you can create an undeletable folder with a reserved name in the Command Prompt app:

1. To access the search box, press the Windows logo key together with S .

2. Enter the Command Prompt search term in the file finder utility.

3. Open Command Prompt with admin rights by selecting the Run as administrator option in the search results.

4. Open the folder where you want to create a new folder by entering the Cd command. For example, execute the following command to display the Users folder in the prompt window:

CdUsers

5. Then enter the command to create this directory and press Enter :

md con

How to create a folder or file that cannot be deleted in Windows 10 Picture 4How to create a folder or file that cannot be deleted in Windows 10 Picture 4

6. Execute this command to close the Command Prompt window:

exit

Now, open File Explorer and the Users folder or other folder where you created the new subfolder. Right clicking on that subfolder and selecting Delete will not delete the folder. The "Location is not available" error message will also appear if you try to open the folder.

How to create a folder or file that cannot be deleted in Windows 10 Picture 5How to create a folder or file that cannot be deleted in Windows 10 Picture 5

 

Of course, a folder that you can't open won't be of much use. However, you can still move files to and from that directory using CMD commands. For example, suppose you want to move the image.png file stored in the C:Users directory to a subdirectory in the same directory. Then you will need to execute this move command:

move "c:Usersimage.png" "c:Userscon"

How to create a folder or file that cannot be deleted in Windows 10 Picture 6How to create a folder or file that cannot be deleted in Windows 10 Picture 6

That command moves the image.png file into a subdirectory. Then you also need to use the same command to move the file out of the subdirectory. The reverse command to move the same file out of that directory back into the Users directory is:

move "c:Usersconimage.png" "c:Users"

Subfolders is one of many reserved keywords you can use for a directory that cannot be deleted. PRN, NUL, COM1, LPT1, AUX and CLOCK$ are other reserved keywords with which you can create undeletable directories.

This subfolder cannot be deleted in File Explorer, but you can still delete it using Command Prompt. To do so, open the include subfolder in Command Prompt. Then execute the following delete command:

rd /s /q con

How to create a folder that cannot be deleted with NH Folder Hider and Locker

If you prefer a more automated method to create an undeletable folder, check out the freeware NH Folder Hider and Locker. NH Folder Hider and Locker is software with which you can lock folders to make them undeletable. You can then unlock the folder with the program whenever you need to access it. You can create a folder that cannot be deleted with that software as follows:

1. Open this NH Folder Hider and Locker page on Softpedia.

2. Download the app, then double-click the downloaded NH Folder Hider and Locker.

3. Select the I agree check box  for the software's license terms.

How to create a folder or file that cannot be deleted in Windows 10 Picture 7How to create a folder or file that cannot be deleted in Windows 10 Picture 7

4. Click Next a few times and select Install .

5. Select Finish in the setup wizard of NH Folder Hider and Locker.

6. Double-click the desktop shortcut NH Folder Hider and Locker.

7. Enter new username and password to open NH Folder Hider and Locker.

8. Click the Set button .

9. Select OK on the NH Folder Hider and Locker dialog box message that appears.

10. Then enter the username and password you just set and click the green tick button.

How to create a folder or file that cannot be deleted in Windows 10 Picture 8How to create a folder or file that cannot be deleted in Windows 10 Picture 8

 

11. Select the Folder Lock tab .

How to create a folder or file that cannot be deleted in Windows 10 Picture 9How to create a folder or file that cannot be deleted in Windows 10 Picture 9

12. Click Browse , select a folder that cannot be deleted and select Lock .

13. Press the Lock button .

14. Then press the OK button of the dialog box.

How to create a folder or file that cannot be deleted in Windows 10 Picture 10How to create a folder or file that cannot be deleted in Windows 10 Picture 10

Go to any folder including the one you just created that cannot be deleted. Right click on your newly locked folder to select Delete . Or select a folder and press the Del key. An access denied message will appear in one of two ways.

How to create a folder or file that cannot be deleted in Windows 10 Picture 11How to create a folder or file that cannot be deleted in Windows 10 Picture 11

If you want to access the folder, you'll need to unlock it. To do so, reopen the NH Folder Hider and Locker software; Click Browse in the window to select the locked folder. Then press the Unlock button to be able to access and delete the folder.

5 ★ | 1 Vote