Neoseeker.com Forum Thread: Can't Delete A Windows Folder. Help? - page 1

reprinted from http://www.neoseeker.com/forums/
original thread: http://www.neoseeker.com/forums/62/t1786136-delete-windows-folder-help/


Author:   Arietta
Date:   Nov 02, 12 at 12:16pm (PST)
Subject:   Can't Delete A Windows Folder. Help?
-------------------------------------------
Hi guys. Please read this thread before asking "WTF ARE YOU TRYING TO DO"...

Basically, a very long time ago, my C drive started to fail (A long time ago as in, like 2008). When I saw that I rapidly copied all of the drive's data into a new hard drive. I didn't have the intention of saving my Windows setup or anything. I just wanted to save its data. But in the rush, I copied absolutely all the folders in C into another hard drive (literally: Ctrl + A, Ctrl + C, Ctrl + V). I bought yet another hard drive and started a new Windows setup.

Fast forward 4 years ahead to today. I'm currently cleaning my hard drives and organizing files. I found the Windows folder from 2008 that I backed up in my rush. But I can't delete it. It always tells me I need permission even though my Windows account does have admin rights. How can I delete a folder that apparently requires permissions I don't have? Sometimes I try to delete the folder, and it tells me I need "TrustedInstaller's" permission to delete it. But I don't think I have that.

Any help and I will love you.




Author:   Dynamite
Date:   Nov 02, 12 at 2:26pm (PST)
Subject:   re: Can't Delete A Windows Folder. Help?
-------------------------------------------
Hi Saga.

Windows is annoying with random permission errors, etc. and tries to restrict even admin accounts which is annoying when you wanna get something done. If you right click it and look through the properties/security settings I believe there may be a choice to force yourself to take ownership of the directory or somesuch, but if you want a method that's basically foolproof follow this procedure:

  1. Download the PsTools suite and put it on your desktop. Extract it to its own folder called PSTools.

  2. Open an elevated command prompt by searching for "cmd", right clicking and choosing "Run as Admin".

  3. Type the following into that command prompt:

    %USERPROFILE%\Desktop\PSTools\PsExec.exe -shi cmd

  4. This will spawn another command prompt in the context of the "system" user which has very comprehensive root privs. You can proceed to try and delete the troublesome folder from there. For example if the folder is C:\whatever then:

    rmdir /S /Q C:\whatever
Obviously you need to be careful as these are powerful commands so make sure you delete the right thing.

There might be a more elegant way via the GUI but I don't have much tolerance for the nonsense layers Windows keeps trying to hide things behind and the "System" account is able to get things done.

Hops this helps. Cheers.



Author:   Arietta
Date:   Nov 02, 12 at 3:34pm (PST)
Subject:   re: Can't Delete A Windows Folder. Help?
-------------------------------------------
Dynamite, thanks for your reply.

But I'm still getting Permission Denied errors. I have followed your instructions step by step. I ran the command line prompt as admin and did as much as I could with admin rights.

When I typed

rmdir /S /Q F:\Windows


(The Windows folder I want to delete is in a F: drive)

I got this:



Any other ideas? I'm kinda wishing Windows had the same permission manage tools as *nix.




Author:   Dynamite
Date:   Nov 02, 12 at 4:09pm (PST)
Subject:   Can't Delete A Windows Folder. Help?
-------------------------------------------
Saga: That sucks. Usually all things retain access for SYSTEM. Before trying step 4, try putting these in between:

takeown /F F:\Windows /R /D Y

icacls F:\Windows /grant system:F /T


Then:

rmdir /S /Q F:\Windows




Author:   Arietta
Date:   Nov 02, 12 at 6:02pm (PST)
Subject:   Can't Delete A Windows Folder. Help?
-------------------------------------------
Didn't work. *Sigh*

I'm one step away from getting a darned Ubuntu Live CD to get rid of all these stupid folders.
Thanks a lot for your help Dynamite. It really sucks I can't get this to work.




Author:   Dynamite
Date:   Nov 02, 12 at 6:05pm (PST)
Subject:   Can't Delete A Windows Folder. Help?
-------------------------------------------
quote Saga
I'm one step away from getting a darned Ubuntu Live CD to get rid of all these stupid folders.
Yeah, that wouldn't be a bad option at all.



Author:   harbin
Date:   Nov 02, 12 at 6:44pm (PST)
Subject:   re: Can't Delete A Windows Folder. Help?
-------------------------------------------
What version of Windows do you have, and what type? I.e. Windows 7 Professional, Home Premium, etc?

The ability to add and change permissions in the GUI would be dependant on that. If you right click the folder, and go to the properties, is there a security tab? If there is no security tab you may need to download and run a registry file and restart your computer for it to appear.



Author:   Arietta
Date:   Nov 02, 12 at 7:59pm (PST)
Subject:   Can't Delete A Windows Folder. Help?
-------------------------------------------
Windows 7 Ultimate (64 Bit).

I tried the taking ownership method and permissions modification thing. I did it via the GUI first (Properties > Security > Advanced to change ownership, and modifying permissions in the same Security tab as earlier). It works - to certain extent. The changes don't spread through files (even though I clicked to apply the ownership to all contained files and folders). I have found that I can delete files if I go into the folder, and do it manually to every folder. But there's literally over a thousand folders here so that's outrageous.

I also think Dynamite's pre-step 4 commands are to change ownership and permissions. So we can say I tried that twice (via GUI and command line) with no luck).




Author:   harbin
Date:   Nov 02, 12 at 8:47pm (PST)
Subject:   Can't Delete A Windows Folder. Help?
-------------------------------------------
TBH I'm not sure how Ubuntu would work with the delete, since the file permissions exist in the file system... sepecially since I'm not that well versed in Linux.

Chances are that somewhere in the entire folder structure, one file hasn't had the permissions inherited, and Windows interrupts the file process, since you can access the folder structure and delete folders individually. When you tried setting the permissions in the GUI, what did you put?



Author:   Dynamite
Date:   Nov 02, 12 at 9:03pm (PST)
Subject:   Can't Delete A Windows Folder. Help?
-------------------------------------------
My CLI commands attempted to take ownership of the folder and all of its contents, then assign full permissions to the SYSTEM user who would in theory then have permissions to delete them. If they didn't work it's difficult to imagine any other method, such as GUI, working.

If the volume was mounted in Linux with necessary permissions the root user could do whatever operation they wanted on them. A simple rm /mnt/drive/Windows -rf would take care of it.

I'm not really a Windows user and it's for reasons like this.



Author:   harbin
Date:   Nov 02, 12 at 9:10pm (PST)
Subject:   re: Can't Delete A Windows Folder. Help?
-------------------------------------------
quote Dynamite
My CLI commands attempted to take ownership of the folder and all of its contents, then assign full permissions to the SYSTEM user who would in theory then have permissions to delete them. If they didn't work it's difficult to imagine any other method, such as GUI, working.

If the volume was mounted in Linux with necessary permissions the root user could do whatever operation they wanted on them. A simple rm /mnt/drive/Windows -rf would take care of it.

I'm not really a Windows user and it's for reasons like this.
TBH I did try creating a folder with two files and putting permissions for 'Everyone' and 'System' set to deny full control, to recurse into child directories, leaving the only way to get a permission back through taking ownership. The method you put for the CLI worked in that case.

I did have a similar problem a few years ago when I copied a ton of files and was inundated with permission issues.



Author:   lKasHl
Date:   Nov 02, 12 at 10:35pm (PST)
Subject:   re: Can't Delete A Windows Folder. Help?
-------------------------------------------
This is one of the most annoying and irritating features of windows, I can't see how protecting redundant system files from a past OS is useful to preserving the current OS.

There are 2 relatively easy ways you can take care of this:
1) Just copy out the files you need and format the drive, given this might not be time efficient if you have alot of data on the drive you want to retain you can try the second option, which also unfortunately can be time consuming, but its alot more automated.

2) Find the folder in which the system files are in, typically you would want to get to the root folder so that you don't have to bother changing multiple file properties manually. Next go to properties and select the security tab. From there you want to click "edit" and then "add." In the context field that pops type "everyone" (minus the quotations). Click okay. Now with everyone selected in the group of users field (should be by default anyway) check the "full control" check box under "allow". Click okay on all the dialogues and you should now have permission to delete anything within the folder for which you changed the permissions.

I'm assuming number 2 should work straight away considering you're using windows 7, if it doesn't though get back to me and we'll work on inheriting the folder permissions to sub folders. Best of luck!



Author:   Arietta
Date:   Nov 02, 12 at 11:34pm (PST)
Subject:   Can't Delete A Windows Folder. Help?
-------------------------------------------
Harbin91 I read somewhere a while ago that *Nix ignores permissions in NTFS drives. I could be wrong though.
... But with Ikashi's first solution (which I... am facepalming hard for not thinking on that on my own) looks like I may not need to do that. The hard drive with these folders are in a drive with little data. I can move it to another drive in the meantime, format it, and stop hitting my head because of it.

Thanks for mentioning formatting Ikashi. I'm now on my bed typing from my iPad (so excuse the typos if any), but I will absolutely do this tomorrow.



Author:   harbin
Date:   Nov 03, 12 at 5:31am (PST)
Subject:   Can't Delete A Windows Folder. Help?
-------------------------------------------
Didn't mention formatting since I wasn't sure if Saga had alot of data that would need backing up. When formatting that I'd recommend ticking the quick format box.

The permissions solutions should've fixed the problem. One thing that ikachi left out of solution 2 was to remove users (typically System, all users, trusted installer, and the admins groups) that had a deny permission set as Deny completely overrides Allow. If System and sagas user account had deny set next to Everyone having allow full control, she'd still need to do a big amount of messing aroung.



Author:   lKasHl
Date:   Nov 03, 12 at 6:20am (PST)
Subject:   re: Can't Delete A Windows Folder. Help?
-------------------------------------------
Glad to hear that helped Saga, sometimes its the most obvious solution that is hardest to come up with

Generally you shouldn't have to worry about permissions being denied in a situation like this since it was just an OS transfer but thanks for the clarification Harbin, from my recollection having a deny permission takes precedence over allow so if one of them was denied it would have wrecked that solution.


Copyright Neo Era Media, Inc. 1999-2014.
All Rights Reserved.