Quantcast
Channel: How can I delete an inaccessible folder on Windows 10? - Server Fault
Viewing all articles
Browse latest Browse all 3

How can I delete an inaccessible folder on Windows 10?

$
0
0

I have a folder on one of my hard drives, P:\csharp\aperture\keystone\src\Keystone, which I want to delete but cannot. I have tried numerous different ways to change/reset permissions and I still cannot delete this folder.

PS P:\csharp\aperture> whoami
azuread\mikelloyd

PS P:\csharp\aperture> rm -Recurse -Force .\keystone\
rm : Cannot remove item P:\csharp\aperture\keystone\src: The directory is not empty.
At line:1 char:1
+ rm -Recurse -Force .\keystone\
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (src:DirectoryInfo) [Remove-Item], IOException
    + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand
rm : Cannot remove item P:\csharp\aperture\keystone\: The directory is not empty.
At line:1 char:1
+ rm -Recurse -Force .\keystone\
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (P:\csharp\aperture\keystone\:DirectoryInfo) [Remove-Item], IOException
    + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand

PS P:\csharp\aperture> rmdir .\keystone\

Confirm
The item at P:\csharp\aperture\keystone\ has children and the Recurse parameter was not specified. If you continue, all children will be removed with the item. Are you sure you want to continue?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): A
rmdir : Access to the path 'P:\csharp\aperture\keystone\src\Keystone' is denied.
At line:1 char:1
+ rmdir .\keystone\
+ ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : PermissionDenied: (P:\csharp\aperture\keystone\:String) [Remove-Item], UnauthorizedAccessException
    + FullyQualifiedErrorId : RemoveItemUnauthorizedAccessError,Microsoft.PowerShell.Commands.RemoveItemCommand

PS P:\csharp\aperture> icacls.exe .\keystone\ /reset /T
processed file: .\keystone\
processed file: .\keystone\src
.\keystone\src\Keystone: Access is denied.
Successfully processed 2 files; Failed processing 1 files

I don't have read privileges.

no read privileges

It can't show the owner:

no owner

If I try to change the owner, I don't have permission to view or edit the object:

enter image description here

What is really strange is that I created the folder with my user, so I should be the effective owner. I have tried to delete the user as Administrator, but I can't do that either. I can't even delete the folder as NT\System:

P:\csharp\aperture\keystone\src>whoami /user

USER INFORMATION
----------------

User Name           SID
=================== ========
nt authority\system S-1-5-18

P:\csharp\aperture\keystone\src>rmdir /S Keystone
Keystone, Are you sure (Y/N)? Y
Access is denied.

nt system authority

How can I delete this folder that I created?


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images