# Couple folders went 'access denied' in Windows. Why and how to fix?

So, after a failed Windows 7 install, I put XP back on, and had a adrenaline shot when I got an access denied on a couple of my backed up folders. I already tried the instructions here at Microsoft KB, but it didn't fix it. I did add myself with full permissions on the main section of the Security tab, though, and that gave me access into the folder (I could do it in XP Home because of the Windows NT SP4 Security Configuration Manager). However, it appears some subfolders are still inaccessible.

Two questions, then. Why exactly did this happen and how do I fix it?

-
FYI, I'll be leaving on a trip Tuesday, and I'll probably be on Super User, but I intend to fix this (see my latest comment on John T's answer) before I leave. Therefore, I won't be able to test any suggestions on this case anymore, because it will no longer exist. That being said, I will probably check this question tomorrow morning (PST) before I fix it. –  Nathaniel Dec 21 '09 at 2:38

Why did it happen?

The user account associated with the permissions isn't the one trying to access them. The folders were probably backed up to an NTFS drive, which kept the permissions intact.

You can try using cacls to take ownership of the files recursively from the command line:

cacls "C:\path\to\folder" /E /T /C /G "Administrator":F

Explanation of the switches:

/E - this edits the access control list currently in place, instead of
replacing it

/T - this allows it to function recursively

/C - this will continue on access denied errors

/G - this grants the user you specify the access rights you specify in
the form of user:permissions. R = Read, W = Write, C = Change,
F = Full control.

Replace C:\path\to\folder with the location of the folder giving you problems. This will look inside that folder recursively and try to change access permissions on everything inside it. Replace Administrator with the administrative account you are taking ownership with.

-
Ah. Handy. Seems to check with what I've been reading. Might want to edit the answer to explain what the switches do: ss64.com/nt/cacls.html –  Nathaniel Dec 20 '09 at 0:12
My pleasure! :) –  John T Dec 20 '09 at 0:14
Hum. I just tried it and got a bunch of ACCESS_DENIEDs. Any ideas? –  Nathaniel Dec 20 '09 at 0:15
It shouldn't have with the /C switch :P are you using an administrator account? –  John T Dec 20 '09 at 0:19
Yes, new XP install. But I haven't added a password to the account yet. Would that make a difference? –  Nathaniel Dec 20 '09 at 0:21