Delete Undeletable Files in Windows Vista
There are files and directories in Windows Vista that seem to impossible to delete and remove away. These persistent undeletable files and folders sometimes can’t even be accessed no matter what, even by an administrator, and you’re pretty sure that the files are not locked by running process. This situation always happen especially if you perform in-place upgrade from Windows XP or install Windows Vista on another partition or hard disk drive, leaving the old XP used partition with its own data.
The problem symptom occurs because the undeletable files and folders’ ACLs (Access Control Lists) were set for accounts with SIDs that applied to an old partition. So these data will effectively owned by nobody or non-existent user when view in Vista operating system. In order to access the file for manipulation, modification or deletion, we will need to take control of the files under Vista.
We can use 2 command-line utilities to take ownership of the files or folders, and then grant full control access permissions to Administrators group, which supposedly you’re a member of. The 2 command line syntaxes are as below. Note that the full path should be included if you’re not at the current directory, and to run these commands, command prompt has to be in elevated mode.
For Files:
takeown /f file_name /d y
icacls file_name /grant administrators:F
For Directories (will perform action recursively):
takeown /f directory_name /r /d y
icacls directory_name /grant administrators:F /t
You can also prepared a Windows shell batch script that automate the process for easy take back the files and folders which is inaccessible and undeletable.
If you’re not comfortable working with command line, you can also using Windows Explorer to do the task. But be warned that it’s a lengthy process, as detailed in how to take ownership and grant permissions guide.
This article has been reposted to Tip and Trick.
Share and contribute or get technical support and help at My Digital Life Forums.
Related Articles
- Remove or Delete Briefcase from Vista New Menu
- How to Take Ownership and Grant Permissions in Windows Vista
- Windows Vista System Junk Cleaner
- Tips of How to Delete Folder Contents While Maintaining Folder Tree Structure in Windows XP PC
- Delete Browsing History for IE7 By Using Command Prompt
- Where is Thumbs.db in Vista?
- Recover and Reclaim ‘Lost’ Disk Space After Installing Windows Vista Service Pack 1 (SP1)
- Add “Empty Folder Contents” To Vista Right Click Context Menu To Delete Files Without Removing Folders
- Delete Files or Folders Locked by Windows Via Unlocker 1.8.7
- Rename “Windows PC 2″ Computer Name in Windows Mobile Device Center (WMDC)

































May 25th, 2007 16:12
[...] possible to take ownership and grant full control permissions from command line. Or you can also prepare a Windows shell batch script that easily perform the task by typing simple [...]
June 29th, 2008 15:40
I still cannot delete my camtasia folders on my desktop using your instructions or these instructions. They only helped me remove a couple JPG files I been try’in to get rid of. CAN SOMEONE PLEASE HELP ME!
Regards,
August 20th, 2008 11:42
good job!
August 24th, 2008 13:37
This doesn’t seem to do any good on my Vista Ultimate system. Sometimes there are files that I simply cannot delete, even after having ownership and running the icacls command.
I have no idea what’s causing it. Sometimes, I can leave the file alone and come back to it later and it will delete just fine. Other times, it simply will not delete without unmounting and remounting the entire drive.
Oddly enough, the files don’t show up anywhere in any handles (checked via process explorer) AND I can even rename the files successfully, which would imply that the files are not locked. And yes, the files still won’t delete even after renaming.
There is something strange afoot with Vista files… not sure what…
August 28th, 2008 19:27
Had exactle the same problems here.
Usually i don’t like to use external programs, but this one helped.
http://ccollomb.free.fr/unlocker/
September 7th, 2008 00:19
Well… thank you very much!
I’ve been trying to free up room on my 2nd drive that had an older Vista installation on it for quite a while. Your command prompt advice worked perfectly.
Take the rest of the day off!
Peter
September 10th, 2008 22:31
Couldn’t delete the files either after this process, so changed the value “administrators” to my local username “Arne” and it worked!
like:
takeown /f “Program Files” /r /d y
icacls “Program Files” /grant Arne:F /t”
Thx, finally some space!
October 3rd, 2008 10:09
Make sure you check the task manager to be sure the file isnt running before trying to delete it. If it is, there is no way to delete it till u stop the process.