deleting windows system folder

I want to use an old drive as a secondary hard drive without reformatting. But this old hard drive contains my old Vista installation which takes up gigs of space. I tried changing ownership and it works to some extent but I can not delete anything in Windows/System32 folder. Is there an easy way to change permissions so I can delete everything?


The solution is to use Takeown as Wil suggested and use cacls to take full control of the files. Since cacls doesn't seem to be recursive, I fired up cygwin and ran this command to recursively change all the files:

for d in $(find directory-of-interest -type d);do
  cacls $d'/*' /e /G username:F;
done

where directory-of-interest is in my case /cygdrive/g/Windows and username is my username.

I had to manually run it on directories that had spaces in its name. But after all this, I can now delete the directory. Warning: it seems to me that cacls can potentially royally screw things up if improperly used.


Solution 1:

Go to the command prompt and use the takeown command.

For example, if the drive is D you can type:

Takeown /f d:\windows /R

This selects the Windows folder on the D Drive and gives the current user access over it and recurses over all subdirectories and files.

Solution 2:

This is involved, but will work for sure.

1.Download and burn a Ubuntu LiveCD. Instructions here: https://help.ubuntu.com/community/BurningIsoHowto

2.Reboot with the live CD in your disk drive. You might have to change your BIOS boot order to do so. Normally F12 allows you to enter this setup, which you change at bootup.

3.Afer loading Ubuntu should come to a screen with buttons that say "Try Ubuntu" and "Install Ubuntu". Click "Try Ubuntu". Ubuntu will bring "log in" and bring you to a desktop.

4.Under the places menu at the top, navigate to your hard drive.

5.Delete the files you don't want.

Note: Ubuntu might have trouble deleting certain files from your system. This is because of the filesystem type. If you have this trouble, download and compile ntfs-3g from: http://www.tuxera.com/community/ntfs-3g-download/

Read the README file for install insructions.

This is involved if you don't use linux or have a liveCD, but if you do, it should be a snap.

If you have any questions, ask them in the comments and I will answer them as to best of my ability