我有一个文件夹在我的一个硬盘驱动器,P:\csharp\aperture\keystone\src\Keystone,我想删除,但不能。我尝试过许多不同的方法来更改/重置权限,但仍然无法删除此文件夹。
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我没有阅读特权。

它不能向主人展示:

如果我试图更改所有者,则没有查看或编辑对象的权限:

真正奇怪的是,我用我的用户创建了文件夹,所以我应该是有效的所有者。我试图以管理员的身份删除用户,但我也做不到。我甚至不能将文件夹删除为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.
如何删除我创建的文件夹?
发布于 2019-03-24 08:33:22
尝试如下:首先,检查您的用户帐户是否是管理员。以管理员身份运行cmd,输入takeown /f P:\csharp\aperture\keystone\src\Keystone,这将为您提供目录的所有权。最后,输入rmdir /q /s P:\csharp\aperture\keystone\src\Keystone,如果它仍然不工作,尝试相同的步骤在安全模式。我希望这能帮到你。
发布于 2021-02-27 14:04:38
尝试解锁: UnlockMe是一个免费的应用程序,用于删除、移动或重命名被另一个进程锁定的文件或文件夹。
https://serverfault.com/questions/959670
复制相似问题