8

I have a few folders that I can't delete:

enter image description here

I right-click > properties > security to try and give myself permission, but no joy:

enter image description here

So I try to take ownership of the folder in advanced > owner...

enter image description here

But no...

enter image description here

So I try running the command prompt as administrator and doing rmdir, doesn't work:

enter image description here

I've run out of ideas! How can I delete these folders?

4
  • Where are these folders in the filesystem? Did you create them yourself? Feb 16, 2012 at 17:02
  • Good point, they were created by a command line application. However, I've deleted many files created by the same application in the past - nothing different there. It's a code generation tool that creates several 'skeleton' code files across a few folders.
    – greg84
    Feb 16, 2012 at 17:04
  • Have you tried deleting in safemode? Feb 16, 2012 at 17:04
  • Good idea @Raystafarian - I'll try that - stick it on as an answer in case it works! :)
    – greg84
    Feb 16, 2012 at 17:06

5 Answers 5

5

Take ownership and add permissions using the command line.

takeown /F (path to folder name) /R /D Y

(takes ownership)

icacls (path to folder name) /grant administrators:F /T

(sets full permissions for the folder to the admin group)

You should be able to delete it now.

If this does method not work due to other complications, boot from a flavor (Ubuntu or other) of Linux Live CD or USB and delete folders and files while in Linux.

2

There's always the live CD method of file deletion. It doesn't take too long, just a couple reboot's worth.

Download your favorite linux Distro (or use a tool such as Bart's PE or the Trinity Rescue Kit (TRK). My personal favorite is the Trinity Rescue Kit. It's got a lot of tools I use with some frequency.

Most Linux live disks by default prevent modifications to your HDD for protection, but they usually also have relatively simple ways of removing these protections to allow advanced file management on the hosts HDD.

0

Uah, I delete a lot of files via CMD line. This is sort of a work around, but run a CMD prompt as an Administrator (Right click > Run as Administrator) and then navigate to the file you want to (EX: cd C:\Users\Me\Desktop) and then type del filename (ex: del moo.txt).

2
  • Tried that, didn't work - got the "Access is denied" error you see above. I'm trying to delete folders, not files, so I needed to use rmdir foldername.
    – greg84
    Feb 16, 2012 at 17:05
  • Ah, I just noticed that at the bottom. Are you an administrator on the machine you're doing this on? Is this machine a part of a domain?
    – Ethabelle
    Feb 16, 2012 at 17:07
0

Malwarebytes has a program called File Assassin that works wonders (most of the time, anyways.)

https://www.malwarebytes.org/fileassassin/

0

Try deleting the files within that folder first,

I've found that when trying to delete user accounts on a machine sometimes you need to delete the files within that folder before deleting the folder itself.

Also, there could be a system file placed in there by mistake that you don't have permission to delete.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .