I am not sure why this happens but there is a workaround.
To take control of the folder containing the undeletable create a text file called “delete.bat” and add the following lines to it:
SET DIRECTORY_NAME="C:\Locked Directory"
TAKEOWN /f %DIRECTORY_NAME% /r /d y
ICACLS %DIRECTORY_NAME% /grant administrators:F /t
ICACLS %DIRECTORY_NAME% /reset /T
PAUSE
- You will need to change the directory path to your “Your Desire Want to Delete Directory” folder or file path e.g. “
C:\Locked Directory
” to “C:\Your Desire Want to Delete Directory
”.
Right click on the file “delete.bat” select “Run As Administrator” and you should now have full control of the directory and all sub directories meaning you can do what you wish with them.
Source: superuser