Tuesday, September 29, 2015

windows - How can I delete this directory?


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
RADISH\Trejkaz .
01/02/2013 14:47
RADISH\Trejkaz ..
01/02/2013 14:47
... 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:



Answer



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.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...