How to delete / modify system files recursively

Windows Vista brought in a series of security features. One of those is that most of system files are no longer owned by Administrators. Instead, there are special account created that own those files. During normal usage, that’s not a problem – but I just installed a new version of Windows on a new hard drive and wanted to delete the previous one.

Turned out – I can’t, as I don’t have the permission to delete those files. I can’t even get that permission as the files are not owned by me, but by those special accounts (Trusted Installer etc.). I would have to take ownership of each file, that grant myself the delete permission. Luckily, there’s an easy way to do that recursively using command line. Just run those two commands against specified folder.