I can't delete a certain folder in Windows 7. It's not a system folder. It was created by an app. I get an error message "You need permission to perform this action. You require permission from Tony....". I am an admin and logged in as myself Tony. I have full ownership of the folder with full control permission. I rebooted the machine. I killed the app which created the folder. I am out of ideas.

Why is Windows 7 not letting me delete the folder?

link|improve this question

55% accept rate
Have you got any background processes: TortoiseSVN, Anti-virus softwares, etc. that might be hanging on the folder (though I agree this is unlikely after a reboot). Alternatively have you tried deleting it while in safe mode? – PeterJCLaw Oct 29 '10 at 18:33
feedback

8 Answers

up vote 5 down vote accepted

The only way was to delete files starting from the lowest level folder in that folder. I got that error message with every folder which had subfolders. I deleted all files/subfolders working my way up.

link|improve this answer
1  
That's the only thing that worked for me as well. – BioGeek Apr 5 at 10:06
feedback

I am not sure why this happens but there is a workaround.

http://blog.bluetoad.net/?p=43

Just in case this user blog is taken down someday I have quoted his/her solution below:

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
PAUSE

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.

link|improve this answer
1  
Tried it but it didn't work. – Tony_Henrich Oct 29 '10 at 18:20
That is a bummer. I was faced with a similar issue on a Windows 7 (64 bit) machine and this worked like a charm. – Sahil Oct 29 '10 at 21:26
1  
It would have been nice if Microsoft fixed this bug in Sp1. This is a massive fail, and I curse each time I have to delete deep nested directories. – ozczecho Apr 7 '11 at 6:12
feedback

I assume UAC is enabled and you are trying to delete the folder from Windows Explorer. You should run Windows Explorer as administrator (right click on the icon and select "Run as administrator") and then delete the folder.

The other alternative is to disable UAC, but I wouldn't recommend it.

link|improve this answer
UAC is off and I am logged in as admin. I tried your method and still same problem. Plus UAC is just a warning and if you say Yes, it continues with its process. – Tony_Henrich Oct 29 '10 at 18:13
@Tony UAC does actually do some other things. I have some legacy applications that won't run under Windows 7 with UAC turned on even if you accept the prompts (in fact, even if you have the prompts turned so low you don't get any running these apps!) I really wish I knew WHY this is, but it is. – Shinrai Oct 29 '10 at 18:53
feedback

When I run into a folder/file I can't delete and rebooting doesn't free the file. I will add to the security setting of the file/folder the Everyone group and set the permissions to Deny Full Control. Then when I reboot the machine, what ever was using the file/folder starts, it won't be able to read/write or lock the file/folder. Finally with nothing being able to use the file/folder, you will be free to delete it.

Hope this helps.

link|improve this answer
feedback

download SysInternals Suite and use the following utilities

use Process Explorer and Process Monitor to find out whats happening with your file

or use the following stand alone utils

use AccessChk to get details not easily available via the GUI

use PSFILE to scan for any process that is holding the file open then try the MoveFile utility to schedule a file delete in the next boot cycle.

The answer you're looking for will show up in the output of one of these utilities

link|improve this answer
Process Explorer has just helped me out with exactly this problem - great tool. – zifot Dec 20 '11 at 20:19
feedback

A folder can disallow a parent from overwriting it's permissions, so it stops working at a certain depth.

Use Process Monitor and filter for ACCESS DENIED events to figure out this depth

Every time an ACCESS DENIED event occurs change the permissions as explained by @Sahil.


You can use Handle too see what processes are opening files within your folder.

handle C:\Path\To\Folder\You\Are\Trying\To\Delete

Example:

C:\Windows\system32>handle C:\Windows\System32\inetsrv

Handle v3.45
Copyright (C) 1997-2011 Mark Russinovich
Sysinternals - www.sysinternals.com

svchost.exe   pid: 1500  type: File  134: C:\Windows\System32\inetsrv\config\schema
svchost.exe   pid: 1500  type: File  1B4: C:\Windows\System32\inetsrv\config\schema
svchost.exe   pid: 1500  type: File  1BC: C:\Windows\System32\inetsrv\config
svchost.exe   pid: 1500  type: File  1CC: C:\Windows\System32\inetsrv\config
svchost.exe   pid: 1500  type: File  1D0: C:\Windows\System32\inetsrv\config
inetinfo.exe  pid: 1572  type: File  3C:  C:\Windows\System32\inetsrv\en-US\inetinfo.exe.mui
inetinfo.exe  pid: 1572  type: File  188: C:\Windows\System32\inetsrv\MBSchema.bin.00000000h
inetinfo.exe  pid: 1572  type: File  190: C:\Windows\System32\inetsrv\MBSchema.bin.00000000h
inetinfo.exe  pid: 1572  type: File  1BC: C:\Windows\System32\inetsrv\MetaBase.xml
inetinfo.exe  pid: 1572  type: File  1D4: C:\Windows\System32\inetsrv\MBSchema.xml
svchost.exe   pid: 1884  type: File  1AC: C:\Windows\System32\inetsrv\config\schema
svchost.exe   pid: 1884  type: File  1C0: C:\Windows\System32\inetsrv\config
svchost.exe   pid: 1884  type: File  1C4: C:\Windows\System32\inetsrv\config
link|improve this answer
feedback

Try moving the folder to your Desktop and deleting it there, odd, but has worked for me under similar circumstances.

link|improve this answer
feedback

No go with Windows 7 Ultimate x64. Finally had to boot from a USB-based linux OS (which ignores file permissions in NTFS file systems) and delete the offending directory that way.

link|improve this answer
feedback

protected by Community May 13 '11 at 7:15

This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.

Not the answer you're looking for? Browse other questions tagged or ask your own question.