How can I delete this directory?

4

I thought I would try to delete a directory today. Little did I know, Windows wasn't going to let me.

C:\Data\Projects\acme\4.2.0>rmdir /s product
product, Are you sure (Y/N)? y
product\release - Access is denied.

This is happening under a command prompt which is running as Administrator. I thought I would try to figure out who it's owned by, if it wasn't Administrator:

C:\Data\Projects\acme\4.2.0\product>dir /q
 Volume in drive C is Windows 8
 Volume Serial Number is 38F9-44D7

 Directory of C:\Data\Projects\acme\4.2.0\product

01/02/2013  14:47    <DIR>          RADISH\Trejkaz          .
01/02/2013  14:47    <DIR>          RADISH\Trejkaz          ..
01/02/2013  14:47    <DIR>          ...                    release
               0 File(s)              0 bytes
               3 Dir(s)  79,467,786,240 bytes free

"..."? What the hell? Let's ask SysInternals, they usually know how things work:

C:\Data\Projects\acme\4.2.0\product>accesschk.exe release

Accesschk v5.03 - Reports effective permissions for securable objects
Copyright (C) 2006-2012 Mark Russinovich
Sysinternals - www.sysinternals.com

  Error getting security for C:\Data\Projects\acme\4.2.0\product\release:
  Access is denied.
No matching objects found.

It seems like I will have to get to SYSTEM level to delete this directory, even though I created it myself.

I tried some techniques mentioned here:

http://blogs.msdn.com/b/adioltean/archive/2004/11/27/271063.aspx?Redirected=true

None of these work because I don't have the required permissions under an Administrator command prompt. Windows 8 seems to have locked this stuff down so hard that you can't use your own computer anymore.

Trying to take ownership via Explorer gives this cryptic dialog, which suggests clicking a Change button which doesn't even exist on the dialog:

Trejkaz

Posted 2013-02-04T00:34:40.787

Reputation: 173

Sounds like the cause is different from mine but that the suggested fix (basically, not using Windows) could be the only way to get around it. – Trejkaz – 2013-02-04T01:14:23.390

You will have full access to that ntfs hd with any linux live cd once its mounted. No windows virus, permission problem or running app/dll can hide from it. I personally like to figure things out which leads to a lot of time which I do not have anymore :) – Logman – 2013-02-04T01:27:51.877

Yeah... I know what you mean. I will give Windows the benefit of the doubt and exhaust every suggestion I get which involves not using another OS before I try to mount the image using anything else. – Trejkaz – 2013-02-04T01:31:45.840

Answers

2

Boot from Hiren's BootCD (actually you don't really need to burn it, it's possible to drop it on a pendrive), then choose Mini Windows XP from the menu and use it to delete that directory.

I think I don't have to mention that to do this, you must have a Windows XP license - otherwise it's illegal.

Another option is to use some Linux distro with ntfs-3g driver (eg. Ubuntu), which is considered safe for writing NTFS volumes - although this is a special case, so be careful.

Ah, and running chkdsk /r C: may help if that's a corrupted file descriptor problem.

gronostaj

Posted 2013-02-04T00:34:40.787

Reputation: 33 047

chkdsk was it. I encountered some other issue at 29% which prevented it completing, but evidently it had already fixed whatever issue it was by that point because I was able to avoid the automatic repair stuff on boot and get in, and now it is deletable. – Trejkaz – 2013-02-04T02:17:48.313

1

Try using 'takeown /f filename' then try to change permissions with cacls/gui. if takeown can't take ownership when running in an admin prompt, you possibly have disk corruption, so running chkdsk on the drive afterwards may help.

Alternatively as has been suggested, delete the file from a Linux distro

Justin

Posted 2013-02-04T00:34:40.787

Reputation: 1 087