Unable to delete folder in windows 7?

23

6

I'm unable to delete some folder on my external hard disk. I tried them to delete in safe mode too but I'm not able to perform this. This is a big headache to me now. Even I'm the admin and it still needs the admin privileges to delete them. So how can I get rid of from this trouble? Please help me!

enter image description here

avirk

Posted 2011-08-10T17:08:48.813

Reputation: 15 151

Answers

14

You could also try Unlocker. It unlocks or kills the process that is using the file/folder and deletes/renames it.

Klemen Košir

Posted 2011-08-10T17:08:48.813

Reputation: 451

404 on that link :( – ScottJ – 2018-04-08T06:44:20.303

1@ScottJ I've updated the link! – Klemen Košir – 2018-06-17T08:09:48.353

18

Try getting the ownership of the folder:

Right-Click the folder -> Properties -> Security tab -> Advanced button -> Owner tab -> Edit button -> Select your user account -> Activate Replace owner on subcontainers and objects.

When done, close all properties windows and open Properties again -> Security tab -> Advanced button -> Permissons tab -> Change Permissons button -> Add your user account and select Replace all child object...

Then try again.

Tex Hex

Posted 2011-08-10T17:08:48.813

Reputation: 2 242

It's very difficult to change security settings with GUI. You might get Access denied error. These folders have owner TrustedInstaller or was it ALL APPLICATION PACKAGES? Even if that works there's another error "Folder is in use by another process". Best is to unlock with tool that created it. For changing security settings best to use subnacl. – Mark Evans – 2016-02-13T12:56:53.970

3Nopes it doesn't worked for me. – avirk – 2011-08-10T17:19:16.627

3And this "Nopes" means that the same message appears again? – Tex Hex – 2011-08-10T17:19:49.613

If the name/identifier in the error message has not changed, then the first stage has not worked. Try again and make sure you have ticked the 'replace owner on subcontainers and objects' checkbox. – sgmoore – 2011-08-10T20:42:04.720

2If you are trying to delete the folders then on the second stage you should also tick 'Full Control' – sgmoore – 2011-08-10T20:42:59.337

Tried everything but nothing works as mention in answer......:-( – avirk – 2011-08-11T05:47:19.283

Have you by any chance stopped or disabled the 'Application Experience' service? If so, start it and re-try these instructions. – sgmoore – 2011-08-11T08:16:00.963

8

My husband had the same problem with his external drive. This is what I did to delete it. These are the steps I followed in windows 7 while logged on under administrator...not sure that part was necessary, but I wanted to include that bit of information.

Phase 1 - Taking ownership

  1. Right click folder
  2. Select "properties"
  3. Select the "security" tab
  4. Click the 'Advanced" button
  5. Select the "owner" tab
  6. Click the "Edit" button
  7. Under 'change owner to' highlight the user you wish to set as owner
  8. Check the 'replace owner on subcontainers and objects' box
  9. click the 'apply' button (this will take you back to the 'advanced security settings' window)

Phase 2 - Permissions

Once you are back in the 'advanced security settings' window follow these instructions (Note: You MAY have to close out the properties window altogether and then re-open it for the above changes to take effect before performing the next set of steps).

  1. Select the 'permissions' tab
  2. Click the "Change permissions" button
  3. Highlight the user you need to change permissions for
  4. click the 'edit' button
  5. Check "allow" box next to full control
  6. Click "Ok"
  7. Check the box next to "include inheritabl permissions from this object's parent"
  8. Check the box next to "replace all child object permissioms with inheritable permissions from this object"
  9. Click "apply"
  10. Click "yes" in the pop up box"
  11. Click "OK" to close permissions window
  12. Click "Ok" to close advanced security settings window
  13. Click "ok" to close the properties window

You should now be able to delete the un-deletable folder.

Phase 3 (it is a shared folder)

Be sure to do the following steps :

  1. Properties
  2. Sharing tab
  3. Share ... Be sure you have your user with read/write Permission level
  4. Come back, Advanced sharing
  5. Permissions be sure your user is here with Full Control

Bri-Anne

Posted 2011-08-10T17:08:48.813

Reputation: 89

5

Sometimes you can't delete a file or a folder because the filename or a file which is in the folder contains a hidden character.

You can delete it in a Command Prompt using DOS commands - a bit of DOS command knowledge is needed.

Once you have a Command Prompt open, navigate to that particular folder, and open it. Delete all files in that folder using del *.*.

Exit that folder, and you should now be able to delete the folder.

drzcyy

Posted 2011-08-10T17:08:48.813

Reputation: 51

1I used rmdir /s to remove it – Matthew Lock – 2016-04-09T11:40:46.957

3

I used Windows cleanup. I accomplished this by following this tutorial. Its for Windows 8 but works just as well for Windows 7.

Press Start -> Type "cleanmgr" and press enter -> Select Windows Drive -> Then find previous Windows installations -> check it -> press OK

That worked for me.

Nick

Posted 2011-08-10T17:08:48.813

Reputation: 1 471

Simple and it works! – Marco Demaio – 2018-04-19T18:41:00.330

2

Just use this text, save it in .reg file, and run this. After this, you can delete/rename these kind of locked folders in single click.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\runas]
@="Grant Admin Full Control"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\*\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"

[HKEY_CLASSES_ROOT\exefile\shell\runas2]
@="Grant Admin Full Control"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\exefile\shell\runas2\command]
@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"

[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Grant Admin Full Control"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"

See full instruction here on How to Delete/Rename/Move Restricted files with one click

Dheeraj Thedijje

Posted 2011-08-10T17:08:48.813

Reputation: 21

Nice answer. However I wouldn't recomend this answer to newbies. Because if they play with privileges of restricted or system folders (accidentally or not) it can create a lot of security issues. – Jet – 2014-04-25T14:13:21.417

0

I also had this problem on Windows 10 with a directory in one of my projects (so not one created by Windows). I got a similar message, but instead it said that it required permissions from me(?). An elevated command prompt didn't work either. Getting ownership and resetting the permissions also didn't fix the issue. Yet after I rebooted my PC I was able to remove the directory (sigh). Probably one of the files was being held by a process.

Wouter

Posted 2011-08-10T17:08:48.813

Reputation: 284

0

I've encountered this problem a few times. I've concluded that something in the OS or some background app has a file or folder open, and the system won't let the operation proceed. The error messages are probably somewhat bogus -- they get an error back and assume it's an auth error.

Never tried to "fix" this since for me it's just an irritation, not a "real" problem. (And what's one more irritation from Windows, in the grand scheme of things?)

Daniel R Hicks

Posted 2011-08-10T17:08:48.813

Reputation: 5 783

0

I had this problem and successfully used the idea of moving and/or incrementally deleting items.

I could not move a folder with two sub-folders and files. It was an old folder, so there was no way anything imaginable could have been using it. I used resource monitor ("search" box, above right section of the handle-and-file sub-window under CPU activity) to verify that the Explorer process window did have something associated. The ONLY process associated with them was the display window (Explorer) and they seem to only have been there because they were within the list of folders being displayed. No other processes were active.

Otherwise, there were no active processes using these files or folders. I checked for lock files or other odd things like hidden or system files and there were none. The command prompt didn't help. Each item had the same name, and I could not move the parent folder in DOS either. NOTHING seems to explain why I could not delete the parent folder, so obviously my knowledge of the intricacies is deficient.

I managed to use Windows Explorer to move each folder's files to another folder (even used the same folder names, but did not copy the name in case an invisible character was there). After moving files, I deleted the folders. Then I put them all in a duplicate file structure right where the old one "was", to see if I could (I could). Finally, I moved the folder (and contents) to its intended new destination. I'm happy! :-)

Roger Dodger

Posted 2011-08-10T17:08:48.813

Reputation: 1

-1

Try changing the permission of the folder first. Make it editable by you.

If that doesn't work, try running explorer.exe as the SYSTEM user.

goweon

Posted 2011-08-10T17:08:48.813

Reputation: 1 390

2I would not recommend people run any application as the SYSTEM user. That can screw so much stuff up it's not even funny, and there's always a proper way around it. If you don't know enough to know why you shouldn't, then you don't know enough to safely do it. – Darth Android – 2011-08-10T22:13:26.400

1-1 for suggesting using the Local System account. As @DarthAndroid said, this is very dangerous and is just as bad as performing non-administrative tasks on a Unix system's root account, if not worse since Windows is not designed to allow users to directly run applications as Local System. – bwDraco – 2011-08-10T23:56:35.150

As @DragonLord said running explorer under SYSTEM is bad. However running cmd.exe under SYSTEM is not dangerous ONLY if you know what are you doing. – Jet – 2014-04-25T14:04:33.010