# 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

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.