0

I have a folder that I want to remove. Somehow, all permissions from that folder have been removed.

The parent folder has appropriate permissions for my admin account. I've tried to apply these permissions to the contained folders, but I get "Access Denied" messages. I've tried to simply update the permissions of the to-be-deleted folder, but I'm told I need read permissions to be able to do that. I've tried to cut and paste the TBD folder as well to try to delete it, but still no luck.

CACLS gave me Access Denied as well.

What else can I try?

I'm running Win10 v1803 build 17134.228

jackwise
  • 111
  • You should be able to utilize the method described in this answer to do it. Just modify the target to be the folder that you want to delete. – Run5k Aug 25 '18 at 17:01
  • @Ramhound CACLS did not work, will update my question. Haven't tried Run5k's suggestion yet – jackwise Aug 25 '18 at 23:03
  • If you can move the directory to a different drive with no contents you care about using a quick format command on that drive will ignore the combative permissions Microsoft implements in Windows. This presumes you that you can at least move the directory. So find an empty drive or create a large enough temporary partition, move the directory to it and nuke it with a quick format. – John Aug 26 '18 at 04:17
  • You can do this easily with a live bootable CD (Ex: Ubuntu, Hiran, etc). – DxTx Aug 27 '18 at 06:43
  • @John My question already states that I have tried this. – jackwise Aug 27 '18 at 11:37
  • The proposed solution within my previous post may be a bit time consuming, but it should work. – Run5k Aug 27 '18 at 12:31
  • @Run5k Yes I'm planning on trying it, just need to find the time :) – jackwise Aug 27 '18 at 13:17
  • Then load the drive in to another system and try to delete the directory that way especially if it's a non-Microsoft OS. – John Aug 27 '18 at 22:14

2 Answers2

1

Assuming the reason you cannot delete the folder is due to there being no permissions*, do the following from an elevated Command Prompt started by a user with Administrative permissions:

takeown /f "C:\folder\folder-to-delete" /a
icacls "C:\folder\folder-to-delete" /inheritance:e

This will exercise the Administrative user's Take ownership of files user right to grant the Administrators group ownership of the object. The second command adds all of the permissions to the folder it should inherit from its parent object.


*Versus problems like being open in another process, or malicious code on the system.

-1

We can try the command to force deletion of files and folders:

  1. Open Command Prompt, run as administrator:

  2. Type: rd /s /q D:\app (If we need to delete the folders, app is the folder name).

  3. Type: del /f /s D:\app.txt (If we need to delete the file, the file name must have a suffix of the file name).

Reference:

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/rd

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/del