I have run into this problem a few times. Mostly on USB-drives that I then want to use on another system, or after reinstalling my Windows-machines and thereby changing the user ID's of the users.
Open a command-prompt with escalated ("Administrator") privileges:
Now go to the problematic area, and use the following commands:
TAKEOWN /F [dir] /R /D Y CD [dir] ICACLS * /T /Q /C /RESET
[dir] is to be replaced with the path to the directory you're trying to fix.
It will, in order of the above commands: