Home » Questions » Computers [ Ask a new question ]

How do I get permissions to delete files on Windows 7?

How do I get permissions to delete files on Windows 7?

I updated my laptop's OS from Windows XP to Windows 7. There are some leftover files from Windows XP on the computer now. If I try deleting them I get the following error:

Asked by: Guest | Views: 186
Total answers/comments: 2
bert [Entry]

"It's possible that by upgrading, the old XP user was not converted well to Windows 7 - therefore these files are owned by a phantom user. You can follow the steps below:

Take ownership of the files. Start a Command Prompt (cmd) as an administrator, and enter:

takeown /f file
takeown /f directory /r

Give yourself full rights on the file:

cacls file /G username:F
cacls directory /T /G username:F

cacls can be used with wildcards and directory traversal. See also:
Security from the command line with CACLS
CACLS command

For a more evolved Visual Basic script see: Xcacls.vbs to modify NTFS permissions."
bert [Entry]

"In my case taking ownership was not enough in Windows 7 for my particular circumstances (my Windows 7 installation was made using Symantec Backup Exec from another machine and the folder was under source control).

I had to perform two further steps:

Right click the folder containing the files you want to delete and select 'Properties' -> 'Security' -> 'Advanced' -> select your user -> 'Change permission' -> Check ""Replace all child object permissions with inheritable permissions from this object""
Delete the files in the folders manually from the innermost to the root. Delete the folders once they are empty, i.e. if you have ""folder1->folder2"" first you delete the contents of folder2, then delete folder2 etc.

If the other solutions are not enough, you can try these further steps."