Delete Undeletable Files in Windows

»»»Delete Undeletable Files in Windows
There are files and directories in Windows OS such as Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10 and so on 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 older version of Windows, such as from Windows XP to Windows Vista, from Windows Vista to Windows 7, from Windows 7 or Windows 8.1 to Windows 10, or install Windows on another partition or hard disk drive, leaving the old Windows 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 Windows.

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

By |2016-12-09T08:40:00+00:00December 9th, 2016|Categories: Windows|Tags: |33 Comments

About the Author:

LK is a technology writer for Tech Journey with background of system and network administrator. He has be documenting his experiences in digital and technology world for over 15 years.Connect with LK through Tech Journey on Facebook, Twitter or Google+.