Following a recent installation of Windows Server 2008 on top of Windows XP, I had difficulty in removing some of the old files that got left behind. Several directories in the root of drive c: were not accessible due to user permissions. The steps for removing the files were very straight forward.
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