Some ways to prevent deletion:
- Modify ownership of the folder.
- Right-clik the folder and select Properties.
- On the Security tab, select Advanced.
- On the Permissions tab, Disable inheritance, removing all inherited permissions.
- This denies permission to do anything to that folder, until you assign an owner and set permissions for that owner. Of course, that owner should be able to delete the folder... so you might want to create a new user for that purpose.
- Use third-party software, such as TunesBro Folder Unbreak or an alternative. N.B. Check reviews and use VirsuTtoal to look for malware before installing any software.
Some ways to prevent deletion:
- Modify ownership of the folder.
- Right-clik the folder and select Properties.
- On the Security tab, select Advanced.
- On the Permissions tab, Disable inheritance, removing all inherited permissions.
- This denies permission to do anything to that folder, until you assign an owner and set permissions for that owner. Of course, that owner should be able to delete the folder... so you might want to create a new user for that purpose.
- Use third-party software, such as TunesBro Folder Unbreak or an alternative. N.B. Check reviews and use VirsuTtoal to look for malware before installing any software.
You can't delete a folder with a locked file in it. The trick is how to keep it open all the time. There are endless ways to do this.
One lightweight way to do this with built in methods would be a scheduled task that runs on boot that opens the files. You could make a hidden system file called something like .criticalFolderLock.cmd that is a script that runs forever.
For example, a script like this:
set lockFile=%userprofile%\Downloads\.criticalFolderLock.cmd
echo pause > %lockFile%
attrib +S +H %lockFile%
%lockFile%
NOTE: Change the path you want to lock open in the lockFile variable.
The only caveat is that this would keep a cmd window running in the background, to keep the file lock.
So I have a huge 7tb folder, I can't spread this into several other folders and preferably not even move the contents at all, and I wanna know how to make this folder, not undeleteable per say, but make it so if I have the folder highlighted and my cat steps on the DEL button, literal weeks of work won't be gone.
Bear in mind I still need to work in this folder, so the whole "deny all permissions" thing is a no-go.
Protect files from being deleted
how to stop domain user to delete any folder file from Desktop and access C drive, I have already blocked the C drive but not able to stop user from deleting folder file from desktop through group policy.
Best practice for preventing folder deletion
Is it possible to protect files to keep them from being accidentally deleted?
Hi Shawn,
Thanks for the note. Where is the "delete" permission? Is that the same as the "write" permission?
Thanks.
Deny permissions always take precedence over allow permissions, so the easiest way to do what you want is to...
1 - Set "Everyone" as "Deny" for "delete". Leave the other permissions in-tact.
It doesn't matter who the owner is, everyone will be blocked from deleting the files until they go through the steps to take ownership and then remove the deny permission, then go back and delete.
You'll retain your ability to add tags and such.
Well... that didn't work for me.
The scenario is this:
- The "server" is a Windows 7 PC
- It has 1 administrator user (admin1) and some others normal users (user1, user2, user3...)
- The file was created by the administrator user and it is located on a share where all users can access and write/change contents (add and delete files and modify contents)
- There is a particular file that I don't want to be accidentally deleted. It has daily backups... but it is constantly being modified (information added)
What I tried:
- Right lick on file > Properties
- Click on 'Security' tab then on 'Advanced' button
- On Permissions tab, I click on 'Add', then on 'Select a principal', type 'Everyone' and click OK
- Back to the other Window/Box, I click on 'Show advanced permissions'... and there the checkbox 'Delete' is unchecked (all the rest of checkboxes I keep as they are)
- On another PC, connected trough network to it as a "normal user", the user accesses the folder where the file is located... and he simply can delete the file
So... what am I doing wrong?
Can you tell me step-by-step what to do, so I can put this working? Can you simulate my scenario and test ir by yourself?
I would appreciate that...
Thank you!
Hi Soheb Khan,
You can create a group policy to deny the delete permission on the folder. Open Group Policy Management Editor, navigate to Computer Configuration / Policies / Windows Settings / Security Settings / File System and set the user permissions in the advanced permissions.
Best Regards,
Ian Xue
If the Answer is helpful, please click "Accept Answer" and upvote it.
I have the same question.
Under NTFS you can alter the access rights for users and groups either at a folder level or at a file level.
Right click on a file or folder and go to the security tab. You can then remove users rights for deleting / modifying a file. Ensure you leave the administrator and administrators full rights. Also, if it on a domain ensure that both the local administrator and domain administrators have full access rights.
Just remove modify permissions from anyone but the user account that creates the file. This kind of thing is exactly what NTFS rights are for.
Due to accidental folder deletion happening too often we’d like to set up folder permissions on the server so that users cannot delete folders/subfolders or files (that they did not create). Two people have been assigned to maintain folders and they can delete and they will be assigned to a special group with those permissions. Looking at the permissions available, this seemed like it would be easy. For example, for the main group who cannot delete would this not seem reasonable NTFS permissions:

I tried it like this and users could still delete folders. I tried unchecking the ‘Delete’ and then users could not rename files or update files.
How would you assign permissions to this group so that they can create and update files, create folders but not be able to delete folders and files (that they did not create).
Thank you
Are you trying to restrict the parent folder only or the sub folders as well? If it is the parent folder then make the parent folder read only but stop inheritance for the sub folders/files so they can read and write.
I have an external hard drive that has every project I've ever made on it, and I regularly go through and update things and clean it up and whatnot. I was wondering if there's a way to mark specific folders so that they don't get accidentally deleted or written over. Is that possible?
For example, if you selected that file (or folder) and pressed "delete," it would delete the others but leave the protected files alone? I've seen things online to give certain permissions to do things like this using the "Security" tab, but I'm the only one who uses my computer. I just want to protect it from accidents, not specific users or anything.