If you do a reinstall of Windows 7 or Vista sometimes you may get files and folders that you cannot delete. I have also had directories on an external drive that I can’t delete when installing an application from that drive.
You will get an error message that access is denied.
This is usually because the file is locked with access control for an account that no longer exists.
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
You will need to change the directory path to match your requirements e.g. “C:\Locked Directory” to “C:\Delete Me”.
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.