Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

4 Answers 4

up vote 8 down vote accepted

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.

share|improve this answer
    
... Is recurses a word / correct spelling? –  William Hilsum Jun 26 '10 at 18:00
3  
Yes, it is: en.wiktionary.org/wiki/recurse –  Tom Wijsman Jun 26 '10 at 18:10
    
@TomWij - thanks +1, I always say Recurse so took a gamble on Recurses, and never seen Wiktionary before! cool, thanks again! –  William Hilsum Jun 26 '10 at 18:13
1  
I had to run cmd.exe as administrator to successfully run this. But even after running it, when I try to delete the folder, it says "You require permission from X\U to make changes to this folder" where X is my hostname and U is my username. Extremely strange. –  Peon Jun 27 '10 at 10:03

Not sure if it will work on System32, but I'd tend to think that something like Unlocker would work for this.

share|improve this answer

I'd suggest reformatting the drive, that way you ensure that the drive is free of any hidden files etc.

Of course, that relies on having enough space to store any files you want to keep elsewhere.

share|improve this answer

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

share|improve this answer
    
I didn't try exactly this but I do run Fedora on virtualbox. I mounted the drive to Fedora, su as root, and tried to delete the directories but "operation is not permitted". –  Peon Jun 27 '10 at 9:49
    
Virtualbox isn't what you want. You want only the linux kernel to load, thus you need to dual-boot or boot from a live CD –  D'Arvit Jun 27 '10 at 18:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.