Search code examples
permissionsfile-permissionstomcat8permission-deniedwindows-server-2012-r2

Windows Server 2012R2 - Access to folder denied for admin


I have a folder on Windows Server 2012 that I want to delete. However, even when I try it in PowerShell or cmd.exe as admin, I'm not allowed to delete or view it. I also tried changing permissions with icals as admin, but was also denied.

The error message when I try to delete it looks like this.

rmdir : Access to the path 'C:\Tomcat8.0\webapps\geoserver\data\coverages' is denied.

At line:1 char:1

rmdir .\data

CategoryInfo : PermissionDenied: (C:\Tomcat8.0\webapps\geoserver\data:String) [Remove-Item], UnauthorizedAccessException

FullyQualifiedErrorId : RemoveItemUnauthorizedAccessError,Microsoft.PowerShell.Commands.RemoveItemCommand

I read that this can be caused by a bug in UAC (User Account Control), so I set it to Never notify, but that didn't change it either.

Background (I'm not sure if this caused the problem): The folder was created by deploying geoserver on Tomcat 8 and trying to manually delete it. The entire folder structure was deleted except for this one folder.

Edit: Maybe it's also worth mentioning that it doesn't matter whether Tomcat is running or not.


Solution

  • I figured out how to delete it now. The folder seemed to be locked by the explorer process somehow.

    Solution: Open cmd as administrator, then stop the explorer task, delete the folder and start a new instance of explorer.exe.